New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-helix-api

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-helix-api

The Simple Helix API allows developers to easily develop applications for Twitch

  • 1.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
increased by2.38%
Maintainers
1
Weekly downloads
 
Created
Source

About

Simple Helix API makes easy to develop applications for Twitch in couple lines of code

Installation

Install with npm:

npm install --save simple-helix-api

Usage

Creating Helix object

const HelixAPI = require("simple-helix-api");
const Helix = new HelixAPI({
    access_token: "xxx",
    cliend_id: "xxx"
});

Params for Helix:

ParamRequiredDefaultDescription
access_tokenfalsenullAccess Token
client_idtruenullClient ID of application
increaseRatefalsefalseUse Bearer instead of OAuth to increase Rate Limit
disableWarnsfalsefalseDisabled warnings in console

Then you can get your profile ID before start working with API

const { id } = await Helix.getUser(username);

Increase Rate

This option uses Bearer authorization instead of OAuth, which allows you to increase the number of requests per minute to 800 instead of 30.

If you want to use this, you need to know that methods like updateStream(), createMarker() force OAuth authorization.

Common methods

Common methods do not require an access token

Get User

Get information about user (example usage: id, profile image, offline image, view count, broadcaster type)

const user = await Helix.getUser(id);

Get Channel

Get channel info like title, game and others

const channel = await Helix.getChannel(id);

Get Stream

Get broadcast information (example usage: realtime viewers count)

const stream = await Helix.getStream(id);

Get Stream Meta

Get broadcast meta information

const meta = await Helix.getStreamMeta(id);

Get Followers

Get first N followers from the end

const followers = await Helix.getFollowers(id, count, after);
ParamTypeRequiredDefaultMaxDescription
idNumbertruenull-ID of user
countNumberfalse20100Number of count of followers that you can get
afterStringfalsenull-Pangination cursor (offset)

Get All Followers

Return an array of all followers. The lead time depends on the number of followers on your channel

const all_followers = await Helix.getAllFollowers(id);

Get Followers Count

Get simple number of followers count

const count = await Helix.getFollowersCount(id);

Get Viewers

Get viewers splitted by categories (broadcaster, admins, staff, moderators, vips, viewers). Attention! This method used username instead of user ID

const viewers = await Helix.getViewers(user_name);

Get Game

Get game by this ID or name

const game = await Helix.getGame("Overwatch");

Get Top Games

Get the top 100 most viewed games on Twitch at the moment

const top = await Helix.getTopGames(count);
ParamTypeRequiredDefaultMaxDescription
countNumberfalse100100Number of games

Other

Update Stream

Attention: access_token is required

Update broadcast information

const response = await Helix.updateStream(id, title, game);
ParamTypeRequiredDescription
idNumbertrueUser ID
titleStringtrueStream title
gameStringtrueGame on the stream

Create Stream Marker

Creating stream marker with description

const marker = await Helix.createMarker(id, description);
ParamTypeRequiredDescription
idNumbertrueUser ID
descriptionStringfalseMarker description (can be empty)

Get Stream Markers

Return an array with markers of specified VOD

const markers = await Helix.getMarkers(id, video_id);
ParamTypeRequiredDescription
idNumbertrueUser ID
video_idStringfalseID of the VOD/video whose stream markers are returned

Create Chatbot

Create chatbot to receive messages from Twitch Chat

You must get oauth token

const oauth_token = "XXXXXX";
const bot = Helix.createChatBot(bot_name, oauth_token, user_name);
bot.on("chat", (channel, user, message) => {
    const username = user["display-name"];
    return console.log(`${username}: ${message}`);
});
ParamTypeRequiredDescription
bot_nameStringtrueThe name of the channel for the bot (you can specify your account nickname)
ouath_tokenStringtrueOAuth Token that you receive
user_nameStringtrueThe name of the channel from which the bot will receive messages

You can find events, methods and examples for chatbot here

Issues

You can report of any issues here

Keywords

FAQs

Package last updated on 14 Jan 2020

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