How to tell if someone changed their Username/DisplayName via the API?

Hey guys, I was wondering if there was a graceful way through the TwitchAPIv5 or Beta Helix API to tell if a user has changed their username or display name? While I use userId’s to identify most people and to recognize them internally with my bot, I haven’t been able to come up with a way to tell if a person actively using my bot has changed their name.

For example:

  • Ralph who is currently, using my chat bot, changes their name to Doug.
  • Now I need to part Ralph and Join Doug in IRC land.

How do I know the above example happened without visually seeing it? I mean I can periodically query the twitch API for a channel and if I get a Unpronounceable entity I can assume it was deleted. I think that code is 429 or something. I’d rather not waste points towards my rate limit with twitch if there is a way around it.

I was looking into this https://dev.twitch.tv/docs/api/webhooks-reference#topic-stream-updown

Which tells me if a stream would go up or down or not and is based off the channel ID. The example response returns no username though. Which means I woulds till have to query the ID for a name.

Can anyone point me to a discussion topic or start one here. Even better an endpoint, maybe a webhook if one exists?

Thanks :slight_smile:

You can use the users endpoint https://dev.twitch.tv/docs/api/reference#get-users and supply up to 100 user id’s, included in the results is their login (username). So what you could do is periodically query that endpoint with all of your user ID’s, and check if their login matches what you have in your database, if it differs then you know their username has changed.

2 Likes

Thanks, I will go ahead and switch to that. :smile:

1 Like

Yeah thats the actual only way you can check if someone changed the username iirc.
And while I can understand your wish for a webhook for this kind of problem. the amount of subscritptions you would have to do is huge. unless you rly just want to narrow it down to the broadcasters registered for your bot. In that case maybe check their names also on bot startup before you join their IRC channels?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.