Skip to content

maxcell/twitch-netlify-example

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

Twitch + Netlify Repo Example

This repository is the full working example from Prince's blog post on "Using Twitch to Invoke a Netlify Function".

Prerequisites

  • A Netlify account
  • A Twitch account
  • Node.js installed

Setting it all up

If you want to just get this all setup and just see it working:

  1. Deploy this repo to Netlify (e.g. using the Netlify CLI ntl deploy --prod)

  2. Take the link that generates and save it for the Twitch CLI

  3. Setup the EventSub subscription through the API or CLI

If you want to do it through the CLI:

twitch api post eventsub/subscriptions --body '{
"type": "stream.online",
  "version": "1",                      
  "condition": {                       
      "broadcaster_user_id": "<USE YOUR BROADCASTER ID>"
  },                      
  "transport": {                                                                          
      "method": "webhook",                                                                
      "callback": "<ADD_YOUR_NETLIFY_LINK>/.netlify/functions/log",
      "secret": "CHANGE_THIS_SECRET"  
  }
}'

Note: The secret is whatever string you'd want it to be. This is a secret you establish with Twitch on this request and whenever you need to verify the signature actually came from Twitch, you'll use this string.

(If you don't have your broadcaster_id use twitch api get users -q login=<YOUR TWITCH HANDKE>)

And it should be all set!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published