// guides

Twitch live notifications in Discord without a bot (free webhook script)

Get a Discord message when your favourite Twitch streamers go live, using Twitch's official API and a channel webhook. One tested Python file, no MEE6 or bot to host, one alert per stream.

Updated 2026-10-16 · about 10 minutes

Rather not set it up yourself? Describe your task in one sentence and we'll build and test it for you, free →

Steps

  1. Create a Discord webhook

    In Discord, open the channel settings, then Integrations, then Webhooks, create one and press Copy Webhook URL. New to webhooks? See Discord webhooks for beginners.

  2. Register a free Twitch app

    Sign in at dev.twitch.tv/console (two-factor authentication must be on), choose Register Your Application, use http://localhost as the OAuth redirect URL and pick a category. Open the app, copy the Client ID and create a Client Secret. These give an app access token, which is all you need to read who is live; no viewer login or bot account.

  3. Save the script

    Copy the script below into twitch_live_to_discord.py. It uses only Python's standard library. It asks Twitch which of your channels are live (up to 100 in one request), posts one message per new stream, and remembers the stream id so the same stream is never announced twice.

  4. Set your channels and keys

    Put these in a .env file next to the script, then check the output without posting anything with python3 twitch_live_to_discord.py --dry-run:

    TWITCH_CLIENT_ID=your_client_id
    TWITCH_CLIENT_SECRET=your_client_secret
    CHANNELS=shroud,pokimane,your_friend
    DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/XXX/YYY

    CHANNELS are the login names from the channel address (twitch.tv/name), comma-separated.

  5. Run it every few minutes

    Each run is one token request and one API call, then the script exits. Every 2 to 5 minutes is plenty:

    */3 * * * * cd /path/to/twitch-alert && set -a && . ./.env && set +a && /usr/bin/python3 twitch_live_to_discord.py >> run.log 2>&1

    No always-on computer? See how to run a Python script on a schedule (cron, Task Scheduler or GitHub Actions). On GitHub Actions, cache or commit twitch_live_state.json between runs, or each run will re-announce streams that are already live.

The script

#!/usr/bin/env python3
"""Post to a Discord webhook when Twitch channels go live. Standard library only."""
import json, os, sys, urllib.parse, urllib.request

ID_URL = os.environ.get("TWITCH_ID_URL", "https://id.twitch.tv/oauth2/token")
API_URL = os.environ.get("TWITCH_API_URL", "https://api.twitch.tv/helix/streams")
CLIENT_ID = os.environ["TWITCH_CLIENT_ID"]
CLIENT_SECRET = os.environ["TWITCH_CLIENT_SECRET"]
CHANNELS = [c.strip().lower() for c in os.environ["CHANNELS"].split(",") if c.strip()][:100]
WEBHOOK = os.environ.get("DISCORD_WEBHOOK_URL", "")
STATE = os.environ.get("STATE_FILE", "twitch_live_state.json")
DRY = "--dry-run" in sys.argv

def call(url, data=None, headers={}):
    req = urllib.request.Request(url, data=data, headers={"User-Agent": "twitch-live-alert/1.0", **headers})
    with urllib.request.urlopen(req, timeout=20) as r:
        body = r.read()
        return json.loads(body) if body else {}

token = call(ID_URL, urllib.parse.urlencode({"client_id": CLIENT_ID, "client_secret": CLIENT_SECRET,
             "grant_type": "client_credentials"}).encode())["access_token"]
query = urllib.parse.urlencode([("user_login", c) for c in CHANNELS])
live = call(f"{API_URL}?{query}", headers={"Client-Id": CLIENT_ID, "Authorization": f"Bearer {token}"})["data"]

seen = json.load(open(STATE)) if os.path.exists(STATE) else {}
now = {s["user_login"]: s["id"] for s in live}
for s in live:
    if seen.get(s["user_login"]) == s["id"]:
        continue  # already announced this stream
    msg = f"🔴 **{s['user_name']}** is live: {s['title']}\nPlaying {s['game_name'] or 'something'} · https://twitch.tv/{s['user_login']}"
    if DRY or not WEBHOOK:
        print(msg)
    else:
        call(WEBHOOK, json.dumps({"content": msg, "allowed_mentions": {"parse": []}}).encode(),
             {"Content-Type": "application/json"})
if not DRY:
    json.dump(now, open(STATE, "w"))

What we saw when we tested it (18 Oct 2026)

Customise it

Prefer n8n?

A Schedule Trigger, an HTTP Request node that POSTs to https://id.twitch.tv/oauth2/token with grant_type=client_credentials, a second HTTP Request to https://api.twitch.tv/helix/streams?user_login=NAME with the Client-Id and Authorization: Bearer headers, Remove Duplicates across executions on the stream id, and a Discord node (webhook) do the same job.

Good to know

Skip the setup: free download

The Twitch live alert agent does all of this. It's tested, MIT-licensed, and comes as an n8n workflow plus a Python script.

Get the free Twitch live alert agent → Or have us build yours →

FAQ

Can Discord notify me when a Twitch streamer goes live without a bot?

Yes. A channel webhook can post the message, and a small script that asks Twitch's API who is live every few minutes decides when. Nothing has to stay online between runs.

Do I need a Twitch API key?

Yes, a free Client ID and Client Secret from dev.twitch.tv/console. You don't need to log in as a viewer or create a bot account.

How many streamers can I follow?

Up to 100 channels per request. For more, run a second copy with its own CHANNELS and STATE_FILE.

Will it spam the channel?

No. It announces each stream once, using Twitch's stream id, and stays quiet until the streamer goes offline and starts a new stream.

Is it free?

Yes. Twitch's API and Discord webhooks cost nothing, and the script is yours to change.

Related guides

New guides

Want one built for your task?

Describe it in one sentence. We build it, test it and email it to you, usually within 24h. Free while we're in beta.

We'll only email you about your agent and TaskToAgent.