Send a message in chat quickly after clicking a button

Hello guys !

I have a basic extension that contains a button. When a user clicks on the button, I want “Hello word” to be written in the chat, as if it were the user who had written in the chat, automatically and quickly.

Should I use IRC? But going through a bot to do this seems complicated and useless.

Is there a POST method in the api to send a message as a user? (I did not find)

How could I do otherwise?

This is resonably impractical as it’s resonably impractical to get oAuth tokens for a viewer using an extension.

An Extension would first need to get permission from the user via an external window to send messages to chat.

There isn’t one

TLDR: it’s not practical to do this.

Why build an Twitch extension to send chat messages. When a user can just chat instead of click a button?

Whats the use case?

Thank you for the answer.

Here is my use case:

I have a game, in which viewers can write in chat “1”, “2” or “3”. My game receives messages and performs actions in functions (for example: viewer XXX throws a bomb).

I would like to create an extension so that the viewer no longer needs to write in the chat but just click on a button to perform these actions.

Here is the flow I thought of:

click on the button 1 => automatically writes the message “1” in the chat => my game receives the message “1” => it does the action

In that case

  • Button press
  • sends data to the EBS
  • Game connects to the EBS
  • Game recieves votes/button clicks from EBS.

So the game connects to your extension backend service instead of TwitchChat.

Then you take out all the chat spam and keep chat tidy instead.

Basically the Extension replaces Chat.

Ok but I’m afraid that going through my backend is slower than writing in the chat.

Receiving via chat is very fast since it’s twitch servers.
If I go through my EBS won’t it cause performance problems?

it should be the same amount of speed or quicker.

Extension Button → send to chat → round trip chat server → game recieve
Extension Button → send to your server → game recieve

Your server should be quicker.

Shouldn’t do no, it should perform better.

As the “bot”/script won’t have to filter chat to remove messages it’s not interested in.

An can use a preferred socket over a noisy chat socket.

1 Like

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