I am trying to use the Twitter api to listen for tweets from one user (1234
)
twitterClient.stream('statuses/filter', { follow: 1234 }, (stream) => {
stream.on('data', tweet => {
console.log('tweet', tweet)
})
stream.on('error', error => {
console.log('error', error)
})
})
This is a node wrapper for Twitter, node-twitter or just ‘twitter’ on npm.
The developer documentation for this feature is here: https://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/post-statuses-filter.html
My issue is the console.log('tweet', tweet)
line never fires, even when I tweet or reply. However, if I use { filter: 'MyKeywordHere' }
as the second parameter, it does fire. So why can’t I follow my account activity?
3
Answers
This code works!
Package: twit
This code also works!
Package: twitter
The follow value must be a string
becomes:
I think this is because there is no user with 1234 as
user_id
.Make sure that you are trying with your own
user_id
asfollow
parameter.