Hello team,
I am trying to register webhook url to my developer account app. I am using Abraham’s library for calling API url’s, 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://mydomain.com/twitter/webhook";
$ucontent = $connection->post('account_activity/all/my_env_name/webhooks', array('url' => $webhookURL));

with this url I am trying to do above code for registering webhook url.
After printing the response above code i.e. $ucontent, it will give me an error as like following image:

I also gone through this documentation, but unfortunately, I don’t have server access.
I communicated with my server administrator; he says TLS 1.2 is enabled and added those listed IP addresses too mentioned in documentation.

I also gone through the existing posts regarding this issue but those are not helpful to me.

I send url in encoded format to the endpoint, as follows:

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_POST['oauth_token'], $_POST['oauth_token_secret']);
$webhookURL = "https://mydomain.com/twitter/webhook";
$ucontent = $connection->post('account_activity/all/my_env_name/webhooks', array('url' => urlencode($webhookURL)));

After executing this statement I got an error as like following image:

Some of the posts I read says need to regenerate the token and token secret for app, so I also did that but not get success.

I don’t understand what I missed in my code?
I didn’t get any solution for how to register webhook url to app.

Please help me for this issue as I stuck on it from last 2-3 days.

Thanks
Sachin K. Endait
Sr. PHP Developer
Nashik, Maharashtra, India

Hello,

can anybody help me for this thread?

Thanks