"Application cannot perform write actions" on newly granted access to environments


#1

Hello there,

we’ve been granted access to the developer environment ( https://developer.twitter.com/en/account/environments ) and I’ve set up an environment dev for “Account Activity APISandbox”:

But when I try to access it, I get an error.

POST /1.1/account_activity/all/dev/webhooks.json?url=https%3A%2F%2Fnpublic-url%2Fpath

But we received a 403 HTTP Status code:

{
  "errors": [
    {
      "code": 261,
      "message": "Application cannot perform write actions. Contact Twitter Platform Operations through https://help.twitter.com/forms/platform."
    }
  ]
}

thanks!


#2

@markntweet have you checked this entry here? How to register a webhook url in Twitter? you should try it with the user token of the owner of the app. :construction_worker_man:t2:‍♂️


#3

Indeed, this solved the problem, thanks!

It’s correct this needs to be done, the documentation is clear => https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/api-reference/aaa-premium#post-account-activity-all-env-name-webhooks states:

Requires Authentication: Yes (user context - all consumer and access tokens)

My initial code was based on https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/api-reference/aaa-enterprise#post-account-activity-webhooks which, actually not to my defense, has exactly the same requirement.

When I wrote testing code when Enterprise wasn’t out of Beta a few weeks ago, I forgot to add the user token and guess: it worked!

And the interesting bit: even today I tried it: I can create a webhook on the Enterprise API without providing a user token. Even though it (probably?) shouldn’t work according to the documentation :woman_shrugging: