Account Activity API - All Activities (beta) whitelist failure

oauth
api

#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: @ogamarket
App ID: 3853320017

I am getting below error each time I try to set webhook

stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [code] => 200 [message] => Forbidden. ) ) )

Please help!


#2

Please @KyleW can you help? Thank you.


#3

During the beta we are unable to approve more than one app and account for access. You’ve only listed one account and app here. Did you include another one when you applied for access? Have you tried both sets of OAuth tokens with the API?


#5

Thanks so much @andypiper. I only applied for one approval but it seems I don’t have access to the account activity API because I keep getting “Forbidden” each time I am trying to set webhook and all.

I have tried the OAuths tokens with the API…I apologise for talking about 2 accounts in my former post. I have just one account. Here is a modified version of my earlier post.

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 account and app:
Account: @ogamarket
App ID: 3853320017
I am getting below error each time I try to set webhook

stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [code] => 200 [message] => Forbidden. ) ) )

#6

It looks like we approved a different App ID for your account and we’re unable to change that at the moment. If you provided a pair of Apps for approval please try the tokens for the other one.


#7

Hi @andypiper…I think the right app was approved, here is a screenshot of the account https://monosnap.com/file/hUzNUzb1VX2pNCemqCnFqTiGU5EUKQ. Maybe, I did not get my ID right. I guess my app ID is the Owner ID…is it?


#8

The app ID is the numerical value you’ll find in the URL bar when viewing the details of your app on apps.twitter.com. You should use the consumer key and secret for that app when registering your webhook. What code snippet are you using to try to register your webhook?


#9

Oh you are right. Here is my App ID: 8887111.

Yes, I am using the consumer key and secret.


#10

Can you post any example code (without the keys)


#11

I am using Abraham Williams (abraham@abrah.am)'s library “The first PHP Library to support OAuth for Twitter’s REST API.” - https://github.com/abraham/twitteroauth

Here is where I set the webhook

    public function setWebhook()
    {
        $param = [
            'url' => config('config_' . env('APP_ENV') . '.application.twitter.webhook_url') //Here is where I set the URL
        ];

        return $this->connection->post('account_activity/all/:env-beta/webhooks', $param);
    }

	/**
         * Digging into the Connection class
	 * POST wrapper for oAuthRequest.
	 */
	function post($url, $parameters = array()) {
		$response = $this->oAuthRequest($url, 'POST', $parameters);
		if ($this->format === 'json' && $this->decode_json) {
			return json_decode($response);
		}
		return $response;
	}

	/**
	 * Further dig
          *Format and sign an OAuth / API request
	 */
	function oAuthRequest($url, $method, $parameters) {
		if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
			$url = "{$this->host}{$url}.{$this->format}";
		}
		$request = \OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
		$request->sign_request($this->sha1_method, $this->consumer, $this->token);
		switch ($method) {
		case 'GET':
			return $this->http($request->to_url(), 'GET');
		default:
			return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata());
		}
	}

Here is the outcome


#12

@andypiper I still need your help. I have my sample code above as requested.


#13

@KyleW can you please help? It seems @andypiper is busy.


#14

Hello @ogamarket,

Can you please remove the colon from the endpoint URL and try again? It should just be env-beta.

Also, make sure you are using oauth 1.0. You will need to include your access token and access token secret as well.

Thanks!


Switching from streams to Webhooks questions
#15

Thank you @LeBraat. Now I get below error

stdClass Object
(
    [errors] => Array
        (
            [0] => stdClass Object
                (
                    [message] => Application cannot perform write actions. Contact Twitter Platform Operations through https://support.twitter.com/forms/platform
                    [code] => 261
                )

        )

)

#16

However, I am using Oauth 1.0


#17

If you are using the consumer key, consumer token, access token, and access token secret of the app that was whitelisted for use with the Account Activity API and you are still receiving the 261 error message, you might need to check your access levels for your access token and access token secret.

Can you please open apps.twitter.com and navigate to the Keys and Access Tokens tab? There, please let me know what access level you have listed under the Application Settings and the Your Access Token sections? There are two different fields to check.


#18

Thank you so much @LeBraat. Funny enough…find below the screenshot of the URL

. We once had this issue when our cron job was misbehaving and I wrote to support, which I explained what went wrong and the restriction was lifted. I wonder why we are having this again when our application has been stable ever since then.


#19

It looks like your app was marked as having abused our spam policy for your follow user rate within the past week or so. I suggest that you write into support again to work this out.

Thanks


#20

Thanks so much @LeBraat. I just saw that too. I have written to support about this again. Thanks.


#21

Thank you once again @LeBraat. The restriction has been lifted. I have another challenge, I get below error even after my URL is prepared for the challenge response. I tried logging every request sent to the URL but nothing is being pushed to it. I mean the CRC token.

stdClass Object
(
    [errors] => Array
        (
            [0] => stdClass Object
                (
                    [code] => 214
                    [message] => Webhook URL does not meet the requirements. Please consult: https://dev.twitter.com/webhooks/securing
                )

        )

)

Also, I have noticed each time I am trying registering my URL, my write access is being restricted. Why is this behaviour?