Twitch Stream notifications for Discord Bots

So I am Trying to figure out how to code a bot to ping a server for when I go Live on twitch. I have tried googling it, but all I can find is instructions on how to get other bots to do it for me. I am new to coding, and have just recently started learning so I don’t know anything about this at all. If someone could help me that would be great.

From what I understand, you want a bot to wait for you to go live on twitch and then send a network request to a remote server. To achieve this, you would need to either use a webhook and an autoscale deployment to make the twitch api send a request to your autoscale deployment repl, and have your replit in turn send a request to the remote server in code. The other method would be to constantly check the twitch api for the status of your channel (live or not) and if so, record it in a database. If the existing database record differs (indicating a state change), then you would send the request to the remote server.

To save money, you would use the first option involving webhooks since the only time the code runs is when you go live. However, I am not familiar with the Twitch API, which would result in the possibility of a livestream webhook not existing. In that case, you would use the second method.

I hope that this was helpful, and if you have any questions, feel free to ask!

2 Likes