Getting error for account_activity api


Hello, I am trying to register webhook with account_activity api but getting this error
{“errors”:[{“code”:32,“message”:“Could not authenticate you.”}]}

I think I am using all the keys and token values correctly but the CRC authentication url is not being called, I found a similar issue here in this thread -

Is there any sort of permission that the app needs before calling this webhook api?


Have you created a developer environment to use the Account Activity API and added your app to it?


Yes I have created developer environment with Account Activity API


Hello @Codesigma_IN,

I responded to you in another topic. Please refrain from posting duplicative content.

Please make sure to review our troubleshooting guide first. Then, if you are still running into issues, please provide the request that you are using so we can investigate further.


@LeBraat @andypiper I have used below script with appropriate keys and callback URL. Please let me know your thoughts.


Hmm. :dev looks unusual as an environment name. Is that what you’ve configured in the dev portal?

Also, I think you’ve posted the same question in two topics. Please do not do this.

Screenshots are not the best way to share code in forums. Please consider posting your code in the topic and using the markup feature </> in the toolbar to mark it as code. It makes it much easier to read and diagnose.


Actually after posting the question, I’ve found this topic and commented it here, will not repeat this again. Also, we have created the environment with the name dev , and deleted it and created another one with different name but facing the same issue.

    // twitter authentication
    $twitter_oauth = [
        'consumer_key' => COSUMER_KEY,
        'consumer_secret' => CONSUMER_SECRET,
        'oauth_access_token' => ACCESS_TOKEN,
        'oauth_access_token_secret' => ACCESS_TOKEN_SECRET,

    // request URL
    $url = "" . rawurlencode('') . "";

    // request method
    $requestMethod = 'POST';

    $twitter = new TwitterAPIExchange($twitter_oauth);

    // POST request to create webhook
    $webHook = $twitter->buildOauth($url, $requestMethod)->performRequest();


OK, so when you register a webhook, you should use a Bearer token (app-only auth).

When you subscribe a user account to the webhook, you’ll need to use the Access Token and Secret.

Try changing your OAuth to use a Bearer token instead.

You could also look at these examples in PHP on GitHub.


Thank You @LeBraat and @andypiper for helping to resolve it. It is working now.