super-ienien / twitter-webhooks

Easy to use expressJs middleware for twitter webhooks api
MIT License
20 stars 3 forks source link

Error: Webhook URL must be defined to create subscriptions #1

Closed shajanjp closed 6 years ago

shajanjp commented 6 years ago

I am getting this error when running the sample code Error: Webhook URL must be defined to create subscriptions screenshot from 2018-08-22 19-07-30

super-ienien commented 6 years ago

Hi,

The code in the doc is not a functionnal sample. You're getting this error because your webhook is not registered to the Twitter API. The reason is that twitter can't reach your webhook endpoint, look at the bottom of the error : Non-200 response code during CRC GET request

to make sure that your webook endpoint is properly configured you should open this in a browser : https://your.domain/path/to/webhook?crc_token=123

You should get a response like this {"response_token":"sha256=3d5U2qieYMPE/+sofKYOeSE6BkVKMqFiP+acNgeUGrYg"}

shajanjp commented 6 years ago

Thanks, my webook endpoint was not properly configured.

vinodsamy commented 5 years ago

Thanks, my webook endpoint was not properly configured.

did you resolve it.i've got same issue..

super-ienien commented 5 years ago

Hi, could you show me your code please ?

vinodsamy commented 5 years ago

const userActivityWebhook = twitterWebhooks.userActivity({ serverUrl: 'https://b216d341.ngrok.io', route: '/', consumerKey: '**', consumerSecret: '', accessToken: '', accessTokenSecret: '*', environment: '', //default : 'env-beta' app });

//Register your webhook url - just needed once per URL userActivityWebhook.register();

//Subscribe for a particular user activity userActivityWebhook.subscribe({ userId: 'my user id', accessToken: 'my access token', accessTokenSecret: 'my access token secret' }) const server = https.createServer({ app });

server.listen(6000);

super-ienien commented 5 years ago

Tour serverUrl should be accessible to the world. The error message « Webhook URL must be defined to create subscriptions » mean that Twitter cannot reach your server.

You should get a valid response from this url : https://b216d341.ngrok.io/?crc_token=123456

vinodsamy commented 5 years ago

Tour serverUrl should be accessible to the world. The error message « Webhook URL must be defined to create subscriptions » mean that Twitter cannot reach your server. You should get a valid response from this url : https://b216d341.ngrok.io/?crc_token=123456

Screenshot from 2019-07-03 15-47-58 actually i got this when i test..

super-ienien commented 5 years ago

You have to route your server’s port 443 to your node app, not to an Apache server

vinodsamy commented 5 years ago

thanks. can i use the ngork for serverURL? and i have used the server port 443 as result is :Error: listen EACCES: permission denied 0.0.0.0:443

super-ienien commented 5 years ago

Yes you can use ngork but you have to shut down your Apache server

vinodsamy commented 5 years ago

i am new to this, could you please tell me how to get ServerUrl??

killallskywalker commented 4 years ago

Hi , im not sure why im get

Error: Webhook URL must be defined to create subscriptions.

even my url is working .

Screenshot 2020-05-14 at 3 58 41 PM (2)