I am making a twitter bot. When someone follows the bot, I would like to send a tweet out that says Thankyou "@their username" for the follow, or something along those lines. How do I get the account's username on the follow event?
Before this was done using the "stream" function but that was discontinued. Does anyone know of a functioning workaround that would allow me to do what I just described in javascript?
Twitter's developer site has a tutorial which describes using the NPM autohook package to build a responder. You'll want to look out for
follow_eventsand respond with a Direct Message.Even if you do take that approach, I'd be careful about running something like this, as a lot of people find this kind of approach a bit spammy. A reminder that the Developer Policy and Twitter Rules have guidance about not sending large numbers of unsolicited mentions.