Node.js Twitch Helix Webhooks
Installation
Install with NPM:
npm install --save twitch-webhook
Usage
const TwitchWebhook = require('twitch-webhook')
const twitchWebhook = new TwitchWebhook({
client_id: 'Your Twitch Client ID',
callback: 'Your Callback URL',
secret: 'It\'s a secret',
listen: {
port: 8080, // default: 8443
host: '127.0.0.1', // default: 0.0.0.0
autoStart: false // default: true
}
})
twitchWebhook.on('streams', ({ topic, event }) => {
console.log(event)
})
twitchWebhook.on('users/follows', ({ topic, event }) => {
console.log(event)
})
twitchWebhook.on('*', ({ topic, event }) => {
console.log(event)
})
twitchWebhook.subscribe('users/follows', {
from_id: 'User id'
})
twitchWebhook.subscribe('streams', {
user_id: 'User id'
})
Documentation
API Reference