JavaScript issue: Unable to send messages in Twitch chat via console

I’m working on a script to get VIP users and their last message dates on Twitch. I need to send /vips and /user commands in chat. But I’m stuck because I can’t input text using JavaScript in the console.

let chatInput = document.querySelector('[data-a-target="chat-input"]');
chatInput.value = 'Hello, Twitch!';

The text shows up briefly in the chat box but vanishes after a few seconds. It doesn’t stick in the textarea tag. I’ve tried manually typing ‘Hello, Twitch!’ too, but no luck.

Has anyone figured out how to send chat messages using only the console? I’m scratching my head here. Any tips or workarounds would be super helpful!

When dealing with Twitch chat, the issue is not just about setting the input value; the platform also monitors user interactions. I found that simulating the typing process more realistically allowed the message to be recognized. One effective approach was to set the input value, then immediately dispatch an input event with bubbling enabled, and finally trigger the chat send button. For example, after changing the text, you could dispatch a new event and then simulate a click on the send button. Although this method isn’t completely foolproof, it did solve the problem in a similar project I worked on. Just keep in mind the importance of following Twitch’s terms of service while implementing such workarounds.