I am using the Twit library to build a Twitter bot in node.js. However, when I want to post a reply to a tweet, it appears, but not in the reply stream.
My code:
twitter.post('statuses/update', { in_reply_to_status_id: data.statuses[0].user.id, status: '@' + data.statuses[0].user.screen_name + ' -some message-' }, function (err, data, res) {});
Where data
is a tweet object I got from a search request.
Any help on this?
The value for the parameter in_reply_to_status_id
must be a Tweet ID to preserve the conversation. You passed here a user ID instead of a Tweet ID.
Also, when working with JavaScript in particular, please make sure you use the stringified IDs id_str
instead of id
to avoid any integer overflow issues.
As a result, below is the updated line of code with the stringified Tweet ID:
twitter.post('statuses/update', { in_reply_to_status_id: data.statuses[0].id_str, status: '@' + data.statuses[0].user.screen_name + ' -some message-' }, function (err, data, res) {});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With