As Per https://dev.twitter.com/webhooks/reference/post/account_activity/webhooks/subscriptions I have request with post method but getting {“errors”:[{“code”:358,“message”:“Unable to parse webhook_id parameter.”}]}
I am confused here as per link I have found that there is https://api.twitter.com/1.1/account_activity/webhooks/:webhook_id/subscriptions.json which have :webhook_id.
I am not sure that do we have replace :webhook_id with webhook Id which we have registered.
Below is my code which I am using but getting error with it.
var request = require(‘request’);
// twitter authentication
var twitter_oauth = {
consumer_key: _environment.env.config.twitter.consumer_key,
consumer_secret: _environment.env.config.twitter.consumer_secret,
token: _environment.env.config.twitter.access_token,
token_secret: _environment.env.config.twitter.access_token_secret
};
// request options
var request_options = {
url: ‘https://api.twitter.com/1.1/account_activity/webhooks/:webhook_id/subscriptions.json’,
oauth: twitter_oauth,
headers: {
‘Content-type’: ‘application/x-www-form-urlencoded’
},
form: {
webhook_id: ‘My webhook ID’
}
};
// POST request to subscribe webhook config
request.post(request_options, function (error, response, body) {
console.log(body);
});
What I am doing wrong here. Please guide me