Webhook registration issue

directmessages
webhooks
account-activity

#1

Hi,

As per Andy’s last suggestion I started building a chatbot app. But I am stuck while trying to register the webhook. The error messages are as below:
Status code - 403
Status text - {“errors”:[{“code”:200,“message”:“Forbidden.”}]}
Below is the code that I am using to create Webhook.
My app ID is = 14947302. Could any one please look into it and suggest if I am missing anything?

Thanks in advance.
Regards,
Diggi


from TwitterAPI import TwitterAPI

import os

CONSUMER_KEY = os.environ.get('CONSUMER_KEY', None)
CONSUMER_SECRET = os.environ.get('CONSUMER_SECRET', None)

ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN', None)
ACCESS_TOKEN_SECRET = os.environ.get('ACCESS_TOKEN_SECRET', None)

print(CONSUMER_KEY)

#The environment name for the beta is filled below. Will need changing in future		
ENVNAME = os.environ.get('ENVNAME', None)
WEBHOOK_URL = os.environ.get('WEBHOOK_URL', None)
print(WEBHOOK_URL)


twitterAPI = TwitterAPI(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)

r = twitterAPI.request('account_activity/all/:%s/webhooks' % ENVNAME, {'url': WEBHOOK_URL})

print (r.status_code)
print (r.text)

#2

This error could be caused by a number of things:

Just to be 100% sure, make sure you have an approved developer account so you can access the premium Account Activity API

Make sure that the environment name that you are using in your request is the same one that was set up in your dev environments page.

Also, make sure that the tokens that you are using are attached to the app that you set in the same dev environments page.

Make sure that the URI ends up in this format:
https://api.twitter.com/1.1/account_activity/all/:env_name/webhooks.json

Let me know if you have everything set up properly.


#3

I’m trying to register my webhook but I’m getting the following error:
https://api.twitter.com/1.1/account_activity/all/development/webhooks.json?url=https://testecomercio.ddns.net
{“errors”: [{
“code”: 214,
“message”: “Webhook URL does not meet the requirements. Please, check your SSL Configuration.”
}]}
The question I have is whether the error stems from the fact that we do not have a registered domain or do not use a paid SSL certificate?

Thank you so much


#6

I’m able to ping that domain, but unable to connect to port 443 using curl, so I suspect either your server is not running (I assume ddns refers to a dynamic DNS service), your SSL configuration is broken, or something else is wrong.


#7

andypiper, good morning, the application was stopped. I’ve already started the server, if you want, you can retake your test


#11

We have a strong hunch that this is an SSL issue. Please review your SSL implementation and make sure it is set up as we suggest on this page:
https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/guides/securing-webhooks


#12

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.