Hello everyone,
I’m trying to register a webhook url on twitter app and I’m using Abraham’s twitteroauth library.
But facing following error after executing Twitter endpoint to register webhook.
stdClass Object(
[errors] => Array
(
[0] => stdClass Object
(
[code] => 214
[message] => Webhook URL does not meet the requirements. Invalid CRC token or json response format.
)
)
)
I was tried to register webhook through code as follows:
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_POST['oauth_token'], $_POST['oauth_token_secret']);
$webhookURL = "https://example.com/twitter/webhook";
$ucontent = $connection->post('account_activity/all/my_env_name/webhooks', array('url' => $webhookURL));
After reading some posts regarding this issue, I was tried the following code with url encoding:
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_POST['oauth_token'], $_POST['oauth_token_secret']);
$webhookURL = "https://example.com/twitter/webhook";
$ucontent = $connection->post('account_activity/all/my_env_name/webhooks', array('url' => urlencode($webhookURL)));
After executing this code facing following error:
stdClass Object(
[errors] => Array
(
[0] => stdClass Object
(
[code] => 214
[message] => Webhook URL does not meet the requirements. Please use HTTPS.
)
)
)
I also read in some articles and regenerate the keys, tokens of my app and newly generated key, tokens in code.
But not get success to register webhook url.
Please help me for this issue with PHP code example if possible.
Thanks
Sachin K. Endait
Sr. PHP developer
Nashik, Maharashtra, India