How to post in Discord when someone goes live

A stream alert is a bot that checks whether a streamer is live every few minutes and posts when they start. In Buildcord that is a scheduled flow, a request to the Twitch API and a message. It needs the Paid plan because schedules run on a bot that stays connected.

6 stepsNo code

Steps

  1. Create a Twitch application

    In the Twitch developer console, register an application. Copy its client ID and client secret.

  2. Save them as secrets

    In your bot's settings, add the client ID and secret as secrets. Secrets are encrypted and only filled in by the request step, so they can't leak into a message.

  3. Draw a scheduled flow

    Add a flow, choose Schedule and set it to run every few minutes, such as */3 * * * *.

  4. Ask Twitch if the streamer is live

    Add two Send an API request steps. The first asks Twitch for an access token with your secrets. The second asks the streams endpoint for the streamer's login name, using that token.

  5. Post once per stream

    Add a condition that continues only when Twitch returns a stream. Check a stored value so the bot doesn't post again for the same stream, then send your message with the stream's title and a link.

  6. Deploy

    Deploy to a gateway bot. Run the flow once from the logs to see each step's result.

Good to know

  • Watching several streamers is a loop over a list of names.
  • Twitch's rules for apps change from time to time, so check the developer documentation for the current token request.
  • The built-in AI agent can draft these steps if you describe the alert you want.

Questions

Does this work with YouTube?

The approach is the same: a scheduled flow that calls the platform's API. The request steps and the way you detect a live stream differ.

More guides

Draw the first flow.

A command, a reply and a deploy is a working bot. It takes a few minutes.

Start building