How to register a webhook url in Twitter?

oauth
api
webhooks

#1

How to register a Twitter Webhook URL in Twitter? I am successful in authorizing my app using application-only authentication. I believe that app-only authentication is required in sending POST Request in https://api.twitter.com/1.1/account_activity/webhooks.json.

The error I received is " {“errors”:[{“code”:261,“message”:“Application cannot perform write actions. Contact Twitter Platform Operations through https://support.twitter.com/forms/platform."}]}”

My app have access with read and write. There is no notification of limiting my access.

What is the problem here? How can I solve this issue?


#2

Have you been granted access to that API yet as I believe it’s still a request only beta


#3

I have the same problem and my app and its access levels to app is ok! (Read, write, and direct messages)


#4

@Ricardo @mergenearellano just to confirm, have you applied for and been granted whitelisted access to the Account Activity API?


#6

I think so. I received the email that I’ve granted access to Account Activity API and my app is already set to these access levels: Read, write, and direct messages


#7

Thanks for confirming. I’ll see if anyone can look into this further.


#8

Thx Andy! If you need more information about my apps, just ping me…


#9

@Ricardo / @mergenearellano,

Can you provide the company name you entered in the application. We’ll try to find your application and double check the permissions on your app. Thanks!


#10

Hi, what’s up Jon?
The name is Harlio Bots


#11

Thanks for your patience, @Ricardo! Your app should have access now. To confirm, the app with access has a consumer key ending in “WL9.”


#12

Hi Jon!

Yes, my consumer key ends with WL9, but I tried to register the webhook right now and got the same message.


#13

Is the body of your request a properly json encoded string?


#14

I’m sending something like this:
{“url”:“https%3A%2F%2Fwww.example.com%2Fautomation%2Ftwitter%2Fendpoint.php”}


#15

Hey @Ricardo, your app may be experiencing another issue unrelated to this endpoint.

Have you reached out through https://support.twitter.com/forms/platform as mentioned in the error message? You might have also received an email on the account associated with the app. Check your spam folder just in case.


#16

They said that my app is suspended, but I really didn’t understand why it’s suspended if I couldn’t even register the webhook after my account linking’s approval.


#17

I am getting the same issue as @mergenearellano:

Application cannot perform write actions. Contact Twitter Platform Operations

Everything is set up correctly and I have received the email saying my app was granted access to this beta. I looked at the support link but it looks pretty generic and I couldn’t find an option that really addressed the problem. Can I DM someone to get this sorted? Company name would be Tuunio.


#18

Updating this thread with the findings of the investigation with @Ricardo. Thanks for your help in narrowing this down!

Providing user access tokens with OAuth1.0a appears to work around this issue. Developers will need to use OAuth1.0a eventually to send Direct Messages on behalf of a user, anyway.

We’ll continue to investigate the app-only OAuth2 issue.

For internal tracking: CUST-4222


#19

When I try to use a user access token with OAuth 1.0a, I get this error:

{
  "errors": [
    {
      "code": 214,
      "message": "Webhook URL does not meet the requirements. Please consult: https://dev.twitter.com/webhooks/securing"
    }
  ]
}

Just can’t get past this stage, I’m afraid.

The docs say that a “detailed error message” will be given, but this is about as generic as it gets. I have no idea why the Webhook URL is failing, and there’s nothing in the error to help narrow it down.

I’ve read the securing docs and followed every step in detail, but it’s just not working for me.

I’m worried about repeatedly trying this as the app is in production. Wonder if I can migrate my beta access to a different app ID - any Twitter devs that can advise on that?


#20

@SteveJonesGtr, the error could be from one of the following:

  • Invalid CRC token or response format. I’ll be discussing this in this thread.
  • High latency on CRC GET request. You’re webhook should respond in less than 1 second.
  • Non-200 response code to CRC GET request (i.e. 404, 500, etc).

And, yes, the error message could be better. We’ll provide this as beta feedback.

We can enable a development app. Fill out another request with this form and mention that your production app was already approved. The submissions are reviewed every couple of days.


#21

@joncipriano - thanks for the quick reply and the detailed information - which would be useful in the documentation. I’ve filed the request for the staging version of the app.

My response is the right format, and there is definitely a 200 response. So the only thing that could be failing is the latency - I’m using ngrok as a tunnel to localhost, which seems pretty slow. I’m seeing 370ms on our staging server, so that should eliminate that.

Where is the latency measured from? ie. where are your servers? I’m based in London, and so are my servers, so it might be a bit of a penalty in terms of latency if they are being pinged from California!