super-ienien / twitter-webhooks

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

[question] I didn't getting any console log on server when someone follows me help!!! #7

Closed iFlameing closed 5 years ago

iFlameing commented 5 years ago

Hi, Just stuck at this point I am able to test the webhook by requesting with ?crc=12345 but I didn't getting any console.log when anyone follows me. can you tell me why. You can see the source code at https://github.com/iFlameing/my-twitter-bot and you can test the app at this Heroku url https://iflameingtwitter-bot.herokuapp.com/?crc_token=123456788. Please tell me what should I do now to see the response.

iFlameing commented 5 years ago

@super-ienien I am getting the following error on heroku

UnhandledPromiseRejectionWarning: Error: Could not authenticate you. 2019-07-22T20:32:12.217155+00:00 app[web.1]: at Request.request [as _callback] (/app/node_modules/twitter-webhooks/lib/helpers.js:27:33) 2019-07-22T20:32:12.217157+00:00 app[web.1]: at Request.self.callback (/app/node_modules/request/request.js:185:22) 2019-07-22T20:32:12.217159+00:00 app[web.1]: at Request.emit (events.js:198:13) 2019-07-22T20:32:12.217161+00:00 app[web.1]: at Request. (/app/node_modules/request/request.js:1161:10) 2019-07-22T20:32:12.217163+00:00 app[web.1]: at Request.emit (events.js:198:13) 2019-07-22T20:32:12.217165+00:00 app[web.1]: at IncomingMessage. (/app/node_modules/request/request.js:1083:12) 2019-07-22T20:32:12.217167+00:00 app[web.1]: at Object.onceWrapper (events.js:286:20) 2019-07-22T20:32:12.217169+00:00 app[web.1]: at IncomingMessage.emit (events.js:203:15) 2019-07-22T20:32:12.217171+00:00 app[web.1]: at endReadableNT (_stream_readable.js:1129:12) 2019-07-22T20:32:12.217173+00:00 app[web.1]: at process._tickCallback (internal/process/next_tick.js:63:19) 2019-07-22T20:32:12.217899+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

iFlameing commented 5 years ago

@super-ienien what do you mean by the user access token and user access token secret I am confused regarding with app access token and app access token secret. what is the difference between user access token and app access token? I got one with twitter developer account but didn't get the second one. can you please tell me from where I can get user access token.

hoemon commented 5 years ago

I also could not make this work, sadly... Any alternatives to this library are much appreciated..

super-ienien commented 5 years ago

@iFlameing If you wan't to make user subscription you have to provide a user access token that you get from oauth authentication process You cannot make subscriptions on behalf of an unauthenticated user.

iFlameing commented 5 years ago

@super-ienien I have consumer key consumer secret access token access token secret from Twitter app key and permission. If I need any thing more than this?

super-ienien commented 5 years ago

If you wan’t to subscribe to user activity events you need to do it on the behalf of a user. So you need his access token and access token secret. In order to get these tokens you need to implement the oauth process explained in the twitter’s doc

hoemon commented 5 years ago

But when you are already using the bot/Dev account you already have all necessary tokens built through the app itself (for the owner account) -

This is how I use all Twitter api's

super-ienien commented 5 years ago

Read the doc to generate your tokens : https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/guides/authenticating-users

Then use the generated tokens to create subscriptions