Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twitch-webhook

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitch-webhook

A Node JS library for new Twitch Helix API Webhooks

  • 0.9.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

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'
})

twitchWebhook.on('streams', (obj) => {
    console.log(obj);
});

twitchWebhook.on('users/follows', (obj) => {
    console.log(obj);
})

twitchWebhook.on('*', (obj) => {
    console.log(obj);
})

twitchWebhook.subscribe('users/follows',{
    from_id: 'User id'
});

twitchWebhook.subscribe('streams',{
    user_id: 'User id'
});

Documentation

TwitchWebhook

TwitchWebHookAPI

Kind: global class

new TwitchWebhook(options)

Constructs an instance of TwitchWebHookAPI

ParamTypeDefaultDescription
optionsObjectOptions
options.client_idstringClient ID required for Twitch API calls
options.callbackstringURL where notifications will be delivered.
[options.secret]stringSecret used to sign notification payloads.
[options.lease_seconds]numberNumber of seconds until the subscription expires.
[options.listen]boolean | ObjectListen options
[options.listen.autoStart]stringfalseShould automaticaly starts listening
[options.listen.host]string""0.0.0.0""Host to bind to
[options.listen.port]number8443Port to bind to
[options.https]boolean | ObjectfalseShould use https connection. If yes, these options to be passed to https.createServer().
[options.baseApiUrl]string""https://api.twitch.tv/helix/\""Base Twitch API URL. It needs for proxying and testing

TwitchWebhook.errors

Returns errors

Kind: instance property of TwitchWebhook

TwitchWebhook.listen([...args]) ⇒ Promise

Start listening for connections

Kind: instance method of TwitchWebhook

ParamTypeDescription
[...args]anyArguments

TwitchWebhook.close() ⇒ Promise

Stop listening for connections

Kind: instance method of TwitchWebhook

TwitchWebhook.isListening() ⇒ boolean

Checks if server is listening for connections.

Kind: instance method of TwitchWebhook

TwitchWebhook.subscribe(topic, options)

Subscribes to specific topic

Kind: instance method of TwitchWebhook

ParamTypeDescription
topicstringTopic name
optionsObjectTopic options

TwitchWebhook.unsubscribe(topic)

Unsubscribes from specific topic

Kind: instance method of TwitchWebhook

ParamTypeDescription
topicstringTopic name

Keywords

FAQs

Package last updated on 30 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc