Message a new Chatter

Using Twitch with Touch Portal

Touch Portal allows you to act on new chatters in your live screen. Whenever they chat for the first time we can show a message on screen to welcome them for example.

First time chatter ever VS. per session

Touch Portal already comes with the information specified by the Twitch API that indicates whether a user has chatted for the first time ever on your channel. But this means not per live sessions or chat session. It is important to make this distinction as you might want to act differently.

This guide will be focussing on how to check if a user is chatting the first not ever but just during this session.


Step 1 - Listening to chat messages

We start with creating an Event in the Events tab that will listen to all messages from all users. Keep everything default. This will catch all incoming chat messages.

Please note that Events & Values can only be used when you have the Pro Upgrade. Get the Pro upgrade to be able to use Events & Values. This guide cannot be finished without it.

Step 2 - Create a Value for user administration

In our event we need to check if this user has chatted for the first time but to know this we need to keep track of all chatters. This Value will hold all the chatters and we will use that to check if somebody has chatted already.


Step 3 - Checking if it is a new chatter

Moving back to our event we will now check if the user of this event has already chatted. We intent to keep the chatters in the Value Twitch Chatters we created in step 2 so we need to check this Value in an IF statement.

Be sure to note that we are using the local State for the chat event. We do this because chat messages can follow up each other in a very fast pace and if we were to use the global states it would mean that the old events could be using the information from the newer chatter messing up the logic. With using local states we ensure that we only use the information that actually triggered that instance of the event.

Be sure to note that we wrapped the username of the chat message in pipe '|' characters. We do this because this is the only way to ensure later on that we have precisely only that specific user.


Step 4 - Saving the new chatter

In the previous step we checked the Value if it contains the current chatter. When the chatter chatted for the first time it will not be contained in the Value and it will go into the flow of actions within the IF statement. So the first thing we need to do is update our Value to also contain this new chatter to not trigger this event the next time anymore for that specific user.

Be sure to note that we wrapped the username of the chat message again in pipe '|' characters. Lets say you have a user called 'EpicNiceUser01'. If we would not use the pipes it means the Value contains 'EpicNiceUser01'. Now lets see when we get a new chatter that has the name 'NiceUser'. As we do not wrap it with pipe characters it will check and it will already exist in the Value so for that user the event will not continue. As this is not something we want we wrap the names in pipe characters. In that case the Value contains '|EpicNiceUser01|' and with that new user the check would be for '|NiceUser|' which the value does not contain and thus the new chatter will be seen as a new chatter as it should.


Step 5 - Do something for that new chatter

At this point we have the structure set up to know whether or not the user of the new chat message is actually chatting for the first time this session. We will now update the text of an OBS source. There are multiple ways of doing this but for now the easiest is to connect a text file to the text source in OBS and update that text file using Touch Portal.

Using the Write to File action we set the text of the OBS to 'Welcome username!'. As this event is triggered for each user for which it has not yet triggered it will update the source text each time a new chatter sends a message.


Step 6 - Per live session?

So how do we now ensure it works for each live session? Well you just need to clear the Value 'Twitch Chatters' each time you go Live. Best place is to add that just before you use the Go-Live action of your choice. Clearing the Value will make Touch Portal forget which users have already chatted and the system starts all over.



Conclusion

You can use this as the basis for more elaborate connectivity with your viewers of course and do lots of nice things like showing specific sources to welcome your users for example.


Back to Guide Overview