python 2.7 - Send direct message to the latest follower with tweepy -
i'm trying create twitter bot send dm (direct message) new follower module tweepy. i'm not sure how can latest user has been following me. i've been reading on docs of tweepy haven't found function job.
here code far (not of code of course):
api = tweepy.api(auth) if event: api.send_direct_message(twitter_user, 'thank following me. cheers!')
you can use api.followers_ids recent follower. api docs state recent follower comes first. take take recent it, compare last follower id stored, , send direct message using user_id keyword argument if id unique.
unfortunately, twitter doesn't provide streaming api endpoint notifies new followers, you're stuck polling api, unfortunately.
Comments
Post a Comment