All Projects → true-dubach → node-twitch-webhook

true-dubach / node-twitch-webhook

Licence: MIT license
A Node.js library for Twitch Helix Webhooks

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-twitch-webhook

pyTwitchAPI
A Python 3.7 implementation of the Twitch API, EventSub and PubSub
Stars: ✭ 132 (+325.81%)
Mutual labels:  twitch, webhook, twitch-helix-webhooks
twitch-graphql-api
KomodoHype
Stars: ✭ 78 (+151.61%)
Mutual labels:  twitch, helix
Twitch4j
Modular Async/Sync/Reactive Twitch API Client / IRC Client
Stars: ✭ 209 (+574.19%)
Mutual labels:  twitch, webhook
twitch api2
Rust library for talking with the Twitch API aka. "Helix", TMI and more! Use Twitch endpoints fearlessly!
Stars: ✭ 91 (+193.55%)
Mutual labels:  twitch, helix
SmartTwitchTV
A Twitch web client that works on Android TVs and web base systems
Stars: ✭ 122 (+293.55%)
Mutual labels:  twitch
orbiter
Orbiter is a tool for collecting and redistributing webhooks over the network.
Stars: ✭ 20 (-35.48%)
Mutual labels:  webhook
imageswap-webhook
Image Swap Mutating Admission Webhook for Kubernetes
Stars: ✭ 72 (+132.26%)
Mutual labels:  webhook
GitHub-Webhook-Bot
It is a Simple Telegram Bot, which will listen to GitHub Webhook and inform via Telegram
Stars: ✭ 33 (+6.45%)
Mutual labels:  webhook
Flask-Shell2HTTP
Execute shell commands via HTTP server (via flask's endpoints).
Stars: ✭ 93 (+200%)
Mutual labels:  webhook
goodfirstissue
openfaas function to handle webhooks for goodfirstissue github app
Stars: ✭ 20 (-35.48%)
Mutual labels:  webhook
tilt-pitch
Simple replacement for the Tilt Hydrometer mobile apps and TiltPi with lots of features
Stars: ✭ 32 (+3.23%)
Mutual labels:  webhook
glitch
!NO MORE MAINTAINED! Reactive API Wrapper for Twitch in Kotlin/JVM
Stars: ✭ 12 (-61.29%)
Mutual labels:  twitch
LogicEFTBot
Twitch / Discord Chat Bot for Tarkov
Stars: ✭ 18 (-41.94%)
Mutual labels:  twitch
DiscordWebhook
Discord webhook library in C#
Stars: ✭ 22 (-29.03%)
Mutual labels:  webhook
tesoro
Kapitan Admission Controller Webhook
Stars: ✭ 32 (+3.23%)
Mutual labels:  webhook
vscode-twitch-themer
A Visual Studio Code extension that listens to Twitch chat and allows viewers to change the streamers VS Code theme.
Stars: ✭ 35 (+12.9%)
Mutual labels:  twitch
dotfiles
NixOS system config & Home-Manager user config
Stars: ✭ 43 (+38.71%)
Mutual labels:  helix
twitch-tui
Twitch chat in the terminal.
Stars: ✭ 80 (+158.06%)
Mutual labels:  twitch
io
A Node.js based system for managing a stream, including a chat bot, overlays, stream note generation and more.
Stars: ✭ 22 (-29.03%)
Mutual labels:  twitch
laravel-dingtalk
✨基于laravel5.5开发的钉钉机器人、支持多个钉钉群
Stars: ✭ 18 (-41.94%)
Mutual labels:  webhook

Node.js Twitch Helix Webhooks

Build Status Coverage Status JavaScript Style Guide dependencies Status devDependencies Status Node version Read the Docs (version) https://nodei.co/npm/twitch-webhook.png?downloads=true&downloadRank=true&stars=true

Little Node.js module to interact with new Twitch Helix API Webhooks.

Install

npm install --save twitch-webhook

Usage

Note: Twitch will return old payload for "users/follows" topic if {first: 1} is not specified

const TwitchWebhook = require('twitch-webhook')

const twitchWebhook = new TwitchWebhook({
  client_id: 'Your Twitch Client ID',
  callback: 'Your Callback URL',
  secret: 'It\'s a secret', // default: false
  lease_seconds: 259200,    // default: 864000 (maximum value)
  listen: {
    port: 8080,             // default: 8443
    host: '127.0.0.1',      // default: 0.0.0.0
    autoStart: false        // default: true
  }
})

// set listener for all topics
twitchWebhook.on('*', ({ topic, options, endpoint, event }) => {
  // topic name, for example "streams"
  console.log(topic)
  // topic options, for example "{user_id: 12826}"
  console.log(options)
  // full topic URL, for example
  // "https://api.twitch.tv/helix/streams?user_id=12826"
  console.log(endpoint)
  // topic data, timestamps are automatically converted to Date
  console.log(event)
})

// set listener for topic
twitchWebhook.on('users/follows', ({ event }) => {
  console.log(event)
})

// subscribe to topic
twitchWebhook.subscribe('users/follows', {
  first: 1,
  from_id: 12826 // ID of Twitch Channel ¯\_(ツ)_/¯
})

// renew the subscription when it expires
twitchWebhook.on('unsubscribe', (obj) => {
  twitchWebhook.subscribe(obj['hub.topic'])
})

// tell Twitch that we no longer listen
// otherwise it will try to send events to a down app
process.on('SIGINT', () => {
  // unsubscribe from all topics
  twitchWebhook.unsubscribe('*')

  // or unsubscribe from each one individually
  twitchWebhook.unsubscribe('users/follows', {
    first: 1,
    to_id: 12826
  })

  process.exit(0)
})

Documentation

API Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].