twitter-webhooks icon indicating copy to clipboard operation
twitter-webhooks copied to clipboard

Error: Webhook URL must be defined to create subscriptions.

Open killallskywalker opened this issue 4 years ago • 5 comments

Screenshot 2020-05-14 at 9 28 50 PM Its weird , when I can hit endpoint for crc_token , but still get the error that related to webhook must be define to create subscription .

1 . Already port forward to allow twitter access localhost . 2 . Result still same , still return webhook URL must be defined . 3 . {"response_token":"sha256=mD1umRhw7hasLluWUzid0zYDCWQbBmbWrNAUx5T4Z/o="} I successfully generate crc , somehow still stuck at Webhook URL muse define .

killallskywalker avatar May 14 '20 13:05 killallskywalker

Hi,

I think it’s because you didn’t call userActivityWebhook.register(); before creating subscriptions. If you don’t call this method, Twitter will not be aware of your server URL and cannot send notifications on your webhook

super-ienien avatar May 15 '20 06:05 super-ienien

Hi @super-ienien , thanks for reply , actually I also already call userActivityWebHook.register() ;

Here the snippets -

//Register your webhook url - just needed once per URL
const userActivityWebhook = twitterWebhooks.userActivity({
    serverUrl:process.env.URL,
    route: '/webhooks',
    consumerKey: process.env.CONSUMER_KEY,
    consumerSecret: process.env.CONSUMER_SECRET,
    accessToken: process.env.ACCESS_TOKEN,
    accessTokenSecret: process.env.ACCESS_TOKEN_SECRET
    environment: "develop",
    app
});

userActivityWebhook.register();

//Subscribe for a particular user activity
userActivityWebhook.subscribe({
    userId: process.env.USER_ID,
    accessToken: process.env.ACCESS_TOKEN,
    accessTokenSecret: process.env.ACCESS_TOKEN_SECRET
})
.then(function (userActivity) {
    userActivity
    .on('favorite', (data) => console.log (userActivity.id + ' - favorite'))
    .on ('tweet_create', (data) => console.log (userActivity.id + ' - tweet_create'))
});

For the server url , I already port forward it to ensure twitter can access It . I could get the response_token , and after that it will trigger the error related to web hook .

killallskywalker avatar May 15 '20 07:05 killallskywalker

Same issue. Anyone found any solution?

dssagar93 avatar May 29 '21 21:05 dssagar93

Same issue ... solution found in 2022 ?

H7-25 avatar May 01 '22 18:05 H7-25

Hello, I will look into it this week

super-ienien avatar May 01 '22 21:05 super-ienien