This example https://github.com/twitchdev/chat-samples/blob/master/javascript/index.html ?
All that example does is generate a leaderboard based on messages in a given time frame
You’d have to modify the code near https://github.com/twitchdev/chat-samples/blob/master/javascript/chatbot.js#L92 to do other stuff with a incoming message.
Your token logic is correct, Twitch Chat Password Generator will return a valid token also.
So, what do you actually mean by: