Account_activity/webhooks/$webhook_id/subscriptions.json returns : string(0) ""

webhooks

#1

With registered webhook, I’m getting string(0) “” response instead of code 204 .

$url = “https://api.twitter.com/1.1/account_activity/webhooks/$webhook_id/subscriptions.json”;

$requestMethod = ‘POST’;
$postfields = array();

$settings = array(
‘oauth_access_token’ => ACCESS_TOKEN,
‘oauth_access_token_secret’ => ACCESS_TOKEN_SECRET,
‘consumer_key’ => CONSUMER_KEY,
‘consumer_secret’ => CONSUMER_SECRET
);

$twitter = new TwitterAPIExchange($settings);
$statuses = $twitter->buildOauth($url, $requestMethod)
->setPostfields($postfields)
->performRequest();

var_dump($statuses);

The auth is OK, I can get account/verify_credentials.json, account_activity/webhooks.json without any problem.


#2

Hello stoney024,

I am using url https://api.twitter.com/1.1/account_activity/webhooks/:webhook_id/subscriptions.json for subscribing my webhook to get post message of user. I want to know that do I have to replace :webhook_id with webhook id which i got by https://api.twitter.com/1.1/account_activity/webhooks.json. As I am new here please guide me.