I'm trying to register a webhook url on twitter app and I'm using this package twitteroauth.
Here's what I've code.
$cbUrl = 'https://123456.ngrok.io';
$envName = 'myDevEnvironment';
$connection = new TwitterOAuth(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
$data = $connection->post('account_activity/all/' . $envName . '/webhooks', ['url' => urlencode($cbUrl)]);
I'm using ngrok to get https of my localhost webhook url. But still getting error code 214 in response and below error message.
{"errors":[{"code":214,"message":"Webhook URL does not meet the requirements. Please use HTTPS."}]}
Any help would be appreciated.
Thank you.
['url' => urlencode($cbUrl)]
Their check for whether the supplied URL starts with https://
probably fails, because you URL-encoded the value. Your package likely takes care of encoding any parameter values in API calls itself, so in this case, you would have encoded it twice now.
If they look for https://
at the start of https%3A%2F%2F123456.ngrok.io
, that will fail.