2021-08-26 21:17:34 +02:00
2021-08-26 17:23:17 +02:00
2021-08-26 16:24:14 +02:00
2021-08-26 15:42:37 +02:00
2021-08-26 21:17:34 +02:00

Node-RED_Twitch_EventSub

Node-RED flow to subscribe, receive and respond to Twitch webhook

Note

Prerequisites

Dependencies

  • node-red-dashboard
  • node-red-contrib-crypto-js-dynamic
  • Optional : node-red-contrib-ngrok

For ngrock users

  • Create a free account on ngrock
  • Save your AuthToken
  • Install the ngrock node on Node-RED
  • Drag and drop a ngrock node on your flow
  • Setup the node using your AuthToken
  • Open a tunnel and save the URL

Twitch Setup

  • Create an APP and save your APP ID and Secret
  • Add the following URL using your domain name or ngrock tunnel URL

Node-RED Setup

  • Import the flow
  • Edit the API Settings node with your
    • Twitch client ID
    • Twitch client secret
    • Sub secret : a password (defined by the user) to validate the Twitch event signature
    • Twitch channel
    • Sub URI : your Node-RED server name or ngrock tunnel URL WITHOUT "HTTPS://" (Ex : your.domain.name or xxxxxxxxxxx.ngrock.io)
    • Scopes (space-separated)
  • Go to the Node-RED dashboard (https://your.domain.name/ui or https://xxxxxxxxxx.ngrock.io/ui)
  • Generate an APP token and USER token by clicking on Auhtorize APP and Authorize USER (will requires to loggin with your Twitch account and accept the scopes)
  • Optional : you can test the validity and expiration of the Token using "Validate" nodes on the Node-RED editor
  • Clic on the "Get channel ID" inject node

Subscribe

  • Subscribe to an event by selecting the desired Event on the Node-RED GUI
  • Clic on "Subscribe"

Unsubscribe

  • Refresh the subscriptions
  • Select the event you want to unsubscribe
  • Clic on "Unsubscribe"

Events

  • When an event is posted to /webhook the JSON will be validated using the "Sub secret" code and sent to the second flow "Reponse"

  • The "Inject" node and "Fake event" function can be removes as they are only used for Testing/Debug purposes

  • Retrieve and use the events informations by connectig your node/function to the annotated functions

HAVE FUN

Description
Node-RED flow to subscribe, receive and respond to Twitch webhook
Readme MIT 1.5 MiB