Send me a message when a viewer joins the channel

There’s no accurate way to know when a user joins a channel. For small channels the join messages will be buffered so a person could be in chat for several minutes before they show as there, and for large channels (>1k users in chat) Twitch Chat stops sending join messages entirely.

There are undocumented endpoints to get the list of users in chat, but that is cached and so wont be very accurate either.

Also, depending on the purpose of your app you should be careful about what sort of user tracking you’re doing unless the user has opted-in to you tracking them.