How to deal with people changing their screen_name?


#1

Hello,
we are experiencing a strange problem.

We have a streaming API connection tracking all people engaged by a conversational advertise running. We store all these tweets with the author screen_name into our database.
Later on, a team select them and send back a tweet to these peoples. The tweet start with @screen_name because our aim is to send a tweet as reply.

But we have the following problem:

  • suppose a user with screen_name as @mycool_name tweet using the conversational advertise now
  • streaming API notify about the tweet by @mycool_name and we store that information into our database
  • some hours later the person change the screen_name from @mycool_name to @anotherfunny_name
  • in our database the record is still with @mycool_name
  • a day later, from our dashboard we want to send a tweet to that person and from our database we create a tweet starting with @mycool_name that it’s wrong and not recognised by Twitter as reply and it pollute our timeline instead of act as a reply.

How can I solve this ?


#2

Use the user_id from the users/lookup REST endpoint, and store that with your initial query. Then, when you reply, you can re-check that user ID and get the current screen_name.


#3

Does The Tweet object sent by Streaming API contains the user_id into it ?


#4

Yes, the user object inside the Tweet should contain that information, which would save you an API call.


#5

Thank you :slight_smile: