2019-07-28
Adding a Twitter Reply via Twitter API
blogentry, javascript, programming, selfnote
blogentry, javascript, programming, selfnote
A quick note to self regarding adding a reply on Twitter using Twitter NPM library.
POST statuses/update lets one "tweet" a status on Twitter.
But when you want to add a reply the an existing twitter, you can set the in_reply_to_status_id to the tweet ID you want to reply to.
The documentation for [in_reply_to_status_id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update#parameters) states that
The ID of an existing status that the update is in reply to. Note: This parameter will be ignored unless the author of the Tweet this parameter references is mentioned within the status text. Therefore, you must include @username , where username is the author of the referenced Tweet, within the update.
Even though it says that it should be "mentioned within the status text", but it doesn't sound 100% correct as passing username mentioned in the following sentence was enough to trigger the reply thread.
https://gist.github.com/dance2die/c4e463b8fa949d1fe7ae5761dd7ed3f9
On line #17, username is passed and that's sufficient to make in_reply_to_status_id not to be ignored by Twitter.
https://mobile.twitter.com/dance2die/status/1155604901558456321