I try to create a nodejs chatbot from example in documentation, but not works

You didn’t convert this username to a user_id

And this isn’t a valid username

This function only checks if a token is good and there no token generation.

You are using websockets, so you need a user token from the user you want to read chat as.

In your code you have:

  • no token generation
  • the read chat as is a username instead of a userID
  • an invalid “read chat as username”

You can compare to this “working example”

https://barrycarlyon.github.io/twitch_misc/eventsub/websockets/web/chat/

Which will ask the visiting user to authenticate and then connect to that visitng users chat.
With the option to connect to other chats.

You’ll find it always uses the numerical ID’s in eventsub calls.

So

            condition: {
                broadcaster_user_id: CHAT_CHANNEL_USER_ID,
                user_id: BOT_USER_ID
            },

I want to read cohhcarnage chat so broadcaster_user_id is 26610234
I have authenticated as barrycarlyon so user_id is 15185913

The owner of the clientID is irrelevant as it’s just a thing used to get oAuth tokens from users

2 Likes