Account activity API errors":[{"code":200,"message":"Forbidden or "code":32,"message":"Could not authenticate you."

account-activity

#1

Sirs,

I got a welcome letter from Twitter saying :

"We have provisioned access to the Account Activity API beta for the single client application you noted in your application for access - app ID 13087009.

To make requests to the API, you will need to know your Dev Environment name:
Env_name: env-beta"

@werowe
app ID 13087009.

But I get either error:

{“code”:200,“message”:"Forbidden
or “code”:32,“message”:“Could not authenticate you.”

Depending on what URL I use.

The instructions say to POST to

https://api.twitter.com/1.1/account_activity/webhooks.json

which gives error 32 “Could not Authenticate you”. So I tried this one which gives error 200 Forbidden.

https://api.twitter.com/1.1/account_activity/all/:env-beta/webhooks.json

So would you look is my account is provisioned?

Code looks like:

url = “https://api.twitter.com/1.1/account_activity/all/:env-beta/webhooks.json

callbackURL = urllib.parse.urlencode({‘url’: “http://xxxxx”})

consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret)
token = oauth.Token(key=access_token, secret=access_token_secret)
client = oauth.Client(consumer, token)

resp, content = client.request( url, method=“POST”, body=callbackURL)

regards,

Walker Rowe


#2

And this CURL is supposed to show whether you are provisioned for webhooks. It looks like I am not:

url --request GET --url https://api.twitter.com/1.1/account_activity/all/webhooks.json --header ‘authorization: Bearer AAAAAAAAAAAAAAAAAAAAAHfLyQAAAAAAgt0lXMilFHFU6wRW%2F4xmK%2B8T7KA%3DvJqLqoqzCt1kJlSStvQBjHP2S9Pw5udko0TxeESx35ghcbTWX7’

{“errors”:[{“code”:200,“message”:“Forbidden.”}]}


#3

Hi, I had the same problem yesterday, this one never works for me
https://api.twitter.com/1.1/account_activity/webhooks.json

but the other one works but you need to remove the ‘:’ character there, its just an indication that its a parameter, not a literal

So the right url is
https://api.twitter.com/1.1/account_activity/all/env-beta/webhooks.json

Hope this helps


#4

I get same message with “https://api.twitter.com/1.1/account_activity/all/env-beta/webhooks.json

“errors”:[{“code”:200,“message”:“Forbidden.”}

Rest of this look OK? meaning am I sending correct parameter and is it properly encoded?

callbackURL = urllib.parse.urlencode({‘url’: “http://xxxx”})

consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret)
token = oauth.Token(key=access_token, secret=access_token_secret)
client = oauth.Client(consumer, token)

resp, content = client.request( url, method=“POST”, body=callbackURL)


Account Activity API - All Activities (beta) whitelist failure
#5

Hey @werowe - I have confirmed you do have access to the Account Activity API using the client App mentioned in your email.

Are you sure you have authenticated the owning user account and are accessing using the correct bearer token?

I can only recommend looking at some of the example apps (and docs) to ensure you are using the correct auth mechanism.


#6

you have any link to help us?please i was try anything and always receive

{
“errors”: [
{
“code”: 200,
“message”: “Forbidden.”
}
]
}


#7

Juan,

I got this to work through CURL, but seems my Twitter account is now blocked, probably because of so many attempts to debug this. Anyway don’t use the oauth approach. It’s app authentication and not user authentication that you need to use. First get a bearer token. That you do once as it remains valid for (not sure how long). Then use the bearer token to register your web hook:

curl -X POST “https://api.twitter.com/oauth2/token” -u “(consumer key):(consumer secret)” -d “grant_type=client_credentials”

curl --request POST --url “https://api.twitter.com/1.1/account_activity/all/env-beta/webhooks.json” -d “url=(encoded URL)” --header ‘authorization: Bearer (Bearer Token created above)’

But now I get this error:

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


#8

I think that error is caused because the URL I created is not created a valid CRC response code. (I was going to work on that later and did not know if was required up front to register a web hook.)

Here is a thread Validating CRC for Webhooks