Hi,
I’m new to Twitter Account Activity API, we use v1 API and our webhooks doesn’t receive twitter DM, what should I do?
Please help, thank you so much in advance.
What implementation / library are you using? Are you receiving any other types of events? are these DMs that appear in the inbox or are these DMs that end up in “message requests”?
i use Account Activity API v1.1, I have tried to use Sandbox and Production environment but no luck, and I only test DM, it appears in the inbox but doesn’t arrive to my webhook.
I don’t know about the library since this web app is developed by our software principal, they said this is twitter issue then I try to find the problem.
And btw, I use free version, don’t know if this is known limitation or what, but I only send the DM not more than 5 messages since yesterday so I don’t think this’s the problem
Thanks, it’s very hard to tell what could be wrong without more details about the implementation. Does it work if you try GitHub - twitterdev/account-activity-dashboard: Sample web app and helper scripts to get started with the premium Account Activity API ? I think this still should work, even though it’s an archived repo.
1 Like
Hi
Thanks, for testing purposes can I use https://webhook.site ?
or I use the Sandbox (free) package, is this the problem?
No idea! i’ve never used that tool, but i would recommend using a sever with a domain name that you can administer (as close to production environment as you can), or failing that, ngrok.com to get a public url for your local test machine.
Is it just the dm not working or all events?
Is the webhook preparation step by step correct and no problems?
The most critical problem is usually in the crc challenge, have you passed this?
What I have tried was only DM, about webhook preparation and the CRC, I will ask the developer.
I’m stuck, do you know if there is a tool that can help me to monitor this?
do you use activity account services at premium API? Or stream endpoint?
Webhook accepts almost all account activity by default, not just DMs, To accept dm only, you have to filter it manually in your code
Is there an error code that you receive?
Can’t your developer solve it either?
Still facing this problem! DM didnot arrivied into our webhook.
Submitted case id: 0256965129 (none answer)
App ID: 23608973
We are stuck on this, and don’t know what to do, we want to try to upgrade the package to Premium but we afraid the same issue still occurs.
1 Like
I use C# codes below (hopefully, you play with C#), only DM events sometimes arrive but sometimes do not arrive, the other events work fine, I don’t think there is a problem with the codes below, since I am able to receive other events in my Webhook_Post below
really need help, I’m in a very tight dateline, and hopefully, a Twitter guys read this!
[HttpGet]
[Route("/twitter/")]
[AllowAnonymous]
public ActionResult Webhook_Get()
{
try
{
var _qs = Request.QueryString;
if (Request.Query.ContainsKey("crc_token"))
{
string crcToken = (string)Request.Query["crc_token"];
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
byte[] keyByte = encoding.GetBytes(Models.Twitter.Consumer_API_Secret);
HMACSHA256 hmacsha256 = new HMACSHA256(keyByte);
byte[] messageBytes = encoding.GetBytes(crcToken);
byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
string hashstring = Convert.ToString(hashmessage);
string response_token = Convert.ToBase64String(hashmessage);
string sha256responsetoken = "sha256=" + response_token;
string jsonData = "{\"response_token\":\"" + sha256responsetoken + "\"}";
Helper.SaveLog("TwitterController.Webhook_Get : here1 " + jsonData, Helper.Log_Mode.Info);
return Content(jsonData, "application/json");
}
else
{
Helper.SaveLog("TwitterController.Webhook_Get : here2 QueryString = " + _qs, Helper.Log_Mode.Info);
string _rb = string.Empty;
using (var reader = new StreamReader(Request.Body))
{
_rb = reader.ReadToEnd();
}
Helper.SaveLog("TwitterController.Webhook_Get : here3 QueryString = " + _qs + " Body = " + _rb, Helper.Log_Mode.Info);
return NoContent();
}
}
catch (Exception _ex) { Helper.SaveLog("TwitterController.Webhook_Get: " + _ex.ToString(), Helper.Log_Mode.Error); }
finally { }
return NotFound();
}
[HttpPost]
[Route("/twitter/")]
[AllowAnonymous]
public async Task Webhook_Post()
{
string _ret = string.Empty;
try
{
var _qs = Request.QueryString;
using (var reader = new StreamReader(Request.Body))
{
_ret = await reader.ReadToEndAsync();
}
Helper.SaveLog("TwitterController.Webhook Webhook_Post : here1 QueryString = " + _qs + " Body = " + _ret, Helper.Log_Mode.Info);
}
catch (Exception _ex) { Helper.SaveLog("TwitterController.Webhook_Post: " + _ex.ToString(), Helper.Log_Mode.Error); }
finally { }
}
1 Like
system
Closed
12
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
Hi All-
The Twitter team was able to fully investigate this issue last week and track down the cause. We are continuing to monitor, but believe that DM delivery through Account Activity API (via free Sandbox, paid premium and enterprise) should be back to expected as of last Thursday. Let us know here if you continue to see dropped DMs through Account Activity API webhook. As a backfill tool, please use the GET direct_messages/events/list endpoint.
2 Likes