Account Activity API - All Activities (beta) whitelist failure

whitelisting
webhooks
account-activity

#1

I would like to be whitelisted for the Account Activity API - All Activities (beta). I applied for access to this using the following link: https://developer.twitter.com/en/apply

It appears, even though I received confirmation that I was accepted, that I was not actually whitelisted for this API.

I would like to whitelist the following two accounts and apps (to start):
Account: @jrhunt
App ID: 12976188

Account: @whereml
App ID: 14504821

There are fewer than 5 months remaining before we can no longer use the streaming APIs so it is important to have timely access to these APIs.

In another application I am whitelisted for the “Account Activity API -
Direct Messages” beta and I am confident that this code is working in that case. If there’s something I’m missing then that’s on me…

from requests_oauthlib import OAuth1Session
twitter = OAuth1Session(
    CONSUMER_KEY,
    client_secret=CONSUMER_SECRET,
    resource_owner_key=ACCESS_KEY,
    resource_owner_secret=ACCESS_SECRET
)
twitter.get("https://api.twitter.com/1.1/account_activity/all/webhooks.json")

Returns

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

The same code making a GET request to: “https://api.twitter.com/1.1/account_activity/webhooks.json” returns:

[{"id":"855959972093452281","url":"SECRET","valid":true,"created_timestamp":"2017-08-29 17:12:10 +0000"}]

Subscriptions.json - {"errors": [{"code": 32, "message": "Could not authenticate you."}]}
Https://api.twitter.com/1.1/account_activity/all/production/subscriptions.json says "Could not authenticate you"
#3

Hi @jrhunt - Thanks for proving the necessary information for us to active your account. We were able to review the two accounts you linked and they do appear to have been approved for Premium access, hurray!

We were also able to provision the Account Activity API All Activities beta access as well. Please note, your dev environment name is: env-beta

Please let us know if you need additional support.


#4

Ok now I’m hitting an error in the documentation I believe:

The page here: https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/api-reference/aaa-standard-all

Suggests that I need to pass in a webhook ID as part of the path (similar to the direct messages API)… but it doesn’t say where in the path I should try to do that.

Here is the documented path on the page you linked:
https://api.twitter.com/1.1/account_activity/webhooks/all/:env_name/subscriptions.json

Which is already different from all of the other URLs that are /account_activity/all/webhooks/ …

Anyway…

I made a few guesses:

base_url=base_url = "https://api.twitter.com/1.1/"
webhook_id=951569276229439488
tests = [
    "account_activity/all/webhooks/env-beta/{}/subscriptions.json".format(webhook_id),
    "account_activity/all/webhooks/{}/env-beta/subscriptions.json".format(webhook_id),
    "account_activity/all/{}/env-beta/subscriptions.json".format(webhook_id),
    "account_activity/all/env-beta/{}/subscriptions.json".format(webhook_id),
    "account_activity/webhooks/{}/subscriptions.json".format(webhook_id),
    "account_activity/webhooks/{}/env-beta/subscriptions.json".format(webhook_id),
    "account_activity/webhooks/env-beta/{}/subscriptions.json".format(webhook_id),
    "account_activity/webhooks/all/{}/subscriptions.json".format(webhook_id),
    "account_activity/webhooks/all/env-beta/{}/subscriptions.json".format(webhook_id),
    "account_activity/webhooks/all/{}/env-beta/subscriptions.json".format(webhook_id)
]
results = []
for test in tests:
    result.append(twitter.post(base_url+test))

Which just returns a ton of 404s…

I also tried submitting it at the URL suggested by the documentation:
https://api.twitter.com/1.1/account_activity/webhooks/all/env-beta/subscriptions.json

But with the webhook_id as part of the request body. No joy.

How do I actually submit one of these? What am I missing here?


#5

Thanks @jrhunt - The correct URL is:

https://api.twitter.com/1.1/account_activity/all/:env_name/subscriptions.json

We will make sure the docs get updated.


#7

@KyleW but then where does the webhook ID in that URL go?


#9

@jrhunt -

Sorry this is not clear we have flagged this internally, to summarize:
POST https://api.twitter.com/1.1/account_activity/all/:env_name/webhooks.json {url:}
This is the request to register a new webhook URL, the encoded URL you’d like to register is one of the parameters of the POST call. The response from this call will include your webhook ID but this isn’t needed since only one webhook URL is available per dev environment.

POST https://api.twitter.com/1.1/account_activity/webhooks/all/:env_name/subscriptions.json
The response from this call assumes your registered webhook and uses the authed user as the setup details needed to register a new subscription.


#10

Cool so the following works:

twitter.post("https://api.twitter.com/1.1/account_activity/all/env-beta/subscriptions.json", params={"webhook_id": webhook_id})

That’s completely different from what the documentation says lol. It says the webhook_id is defined in the resource path not passed in as a parameter. This is also different from the direct messages API which has the webhook_id as a resource path.

Would be cool to have this be a tad more unified.

Thanks all for your help. I look forward to the docs updates.


#11

Yes, thanks a bunch for feedback.

You do not need a webhook ID as there is only a single webhook defined on your environment.


#12

So 2 weeks ago I left some feedback here. The docs are still in rough shape though. I’m curious who at twitter is actually owning this problem. It’s incredibly frustrating to go to the documentation in it’s current state and have very little accurate information. You’re still asking people to port to this API by June and I just don’t see how they’re supposed to do that when the docs are in their current state.

There are errors on both the account activity pages and on the direct messages API pages. The docs need to be overhauled.

I did a live stream on twitch the other day where I changed my credentials so the CRC check failed. I wanted to revalidate by calling the PUT event which gave me a 404 no matter what environment name I used (env-beta) or other tricks I tried. Finally, I tried to just delete the webhook and start again but unfortunately that didn’t even work. It was infuriating. Then, randomly, it got marked as valid again. I have no idea how or why.

I know I’m being super critical here. I trust that everything is working on your end it’s just that the communication to your users is unclear. I do think this webhook API is awesome. I’m really enjoying building things with it… but … please, please, please prioritize getting this API to GA and getting the documentation fixed.

It would also be amazing if you guys could include example webhook events and event types listed somewhere.

If you can’t prioritize that work, I think deactivating the streaming API in June would be a really terrible move on Twitter’s part.


#13

Hey @jrhunt - thanks for the feedback. There is a lot in this post.

We recently went back through these docs to work on cleaning them up. I believe those will be posted soon (if not live already). Unfortunately, when we make doc changes, they go through a review process that can slow down the actual post of them.

Regarding timing - we are working to ensure developers have a few months to move to a GA product before we deprecate US/SS. Look for the GA product soon.

I am glad to hear you think this endpoint is awesome, we will continue to make the on boarding experience easier based on feedback from our community members like yourself.


#14

Hi,

We are experiencing the same problem with all activities (beta) access. We applied and received approval confirmation, but all our requests are resulting in:
{“errors”:[{“code”:200,“message”:“Forbidden.”}]}
Account: @fanbooster
App ID: 16154103

Thanks,
Mihail


#15

Hi @mihail_y_ivanov - It looks like your account was not set up to access the Account Activity API. We were able to go ahead and provision access for the App you posted. Your environment name is: env-beta.

Please be sure to check the documentation if you have any questions.


#16

Hi @KyleW I have the same issue where I was accepted after I applied at https://developer.twitter.com/en/apply but did not get access to Account Activity API.

App ID: 14687895

Thanks,
Alex


#17

@steffes - Looks like you are all set. Mind giving it a try again? Your environment name is: env-beta

Please be sure to check the documentation if you have any questions.


#18

Thank you @KyleW!


#19

@KyleW could you help take a look at this account for the All Activities (beta):

App ID: 13002066
Account: @DemoCompany_

Owner: DemoCompany_
Owner ID: 728128813276667904

I applied for this over a week ago (almost 2) now. Thanks!


#20

It looks like you have access and were actually granted access about a week ago. Have you given it a try recently?


#21

@KyleW could you please help me

i’m stuck with following error on registering webhook url with POSTMAN
{
“errors”: [
{
“code”: 214,
“message”: “Non-200 response code during CRC GET request (i.e. 404, 500, etc).”
}
]
}

my application webhook method is not receiving the call from twitter.[i have created both GET and POST methods]

application is deployed on AWS box and its working fine with facebook webhooks integration

webhooks url:
https://XXXXXXXXXXX:10352/api/social/socialfeed/twitter/onmessage?user=dummyUser&organization=dummyOrg

Code:
@RequestMapping(value = “/onmessage”, method = RequestMethod.GET)
public @ResponseBody
String twitterChallengeResponseCheck(@ApiParam(value = “user”, required = true) @RequestParam(“user”) String user,
@ApiParam(value = “organization”, required = true) @RequestParam(“organization”) String organization,
@ApiParam(value = “verifyToken”, required = true) @RequestParam(“crc_token”) String verifyToken)
{…}

@RequestMapping(value = “/onmessage”, consumes = { MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.POST)

public void receiveTwitterActivities(@ApiParam(value = "user", required = true) @RequestParam("user") String user,
        @ApiParam(value = "organization", required = true) @RequestParam("organization") String organization,
        @ApiParam(name = "twitter webhook real time update data", required = true) @Valid @RequestBody String twitterPayload,
        @ApiParam(name = "twitter security signature", required = true) @RequestHeader(value = "x-twitter-webhooks-signature") String securitySignature)
        throws Exception
{ ......}

if you any additional information to validate, i can provide.


#22

Are you sure you rendered 200 OK because that’s what the error states?


#23

Thanks @KyleW