How to register webhook url



I am trying to register a webhook url to receive events. But I am getting an error in response as below:

    "errors": [
            "code": 261,
            "message": "Application cannot perform write actions. Contact Twitter Platform Operations through"

I am using application only authentication to perform OAuth2. I am using php for this.
What can be the issue here?


@vinodsaini could you send your request header?


@R_Amsaveni Thanks for the reply.

I am using below code ;

$url =  urlencode('');
$webhooksUrl = '' . $url;
$token = 'my_access_token';
$headers = array(
	'authorization: Bearer ' . $token,
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $webhooksUrl); 
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
$result  = curl_exec($ch); 
echo '<pre>';print_r($result);exit;


Have you encoded your access token using base64 encoder?


Yes, I have created bearer token using base24 encode. See below code to generate access token;

$encodedBearerTokenCredentials = base64_encode($consumer_key . ':' . $consumer_secret);
$authUrl = '';
$headers = array(
	'Content-Type: application/x-www-form-urlencoded;charset=UTF-8',
	'Authorization: Basic ' .  $encodedBearerTokenCredentials,

And post this using curl method.


The above link will explain how to generate bearer token. It says to use base64 encoder.

why don’t you try this one

sorry if I’m wrong :slightly_frowning_face:


@Amsa I used the same link to generate bearer token already. But its showing same error.

Above link doing base64_encode($consumer_key . ':' . $consumer_secret);