You can use api.followers_ids
to get the most recent follower. The api docs state that the most recent follower comes first. You take take the most recent it, compare it to the last follower id you stored, and send a direct message using the user_id
keyword argument if the id is unique.
Unfortunately, Twitter doesn't provide a Streaming API endpoint that notifies you about new followers, so you're stuck polling the API, unfortunately.