JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 114
  • Score
    100M100P100Q11289F
  • License MIT

Module for Twitch's v5 API

Package Exports

  • twitch-api-v5

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (twitch-api-v5) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Twitch_API_v5

Simple module to use Twitch's API v5 for all endpoints (with the exception of clips and video upload which are only available using v4). For details on optional parameters or required authentication scopes please follow the links to the Twitch docs.

This module also includes undocumented endpoints (such as the chatters endpoint to view which users are currently in a channels chat), these should be used at your own risk and are should be expected to change or be removed at any time.

Contents


Getting Started

Install

npm install twitch-api-v5 --save

Examples

var api = require('twitch-api-v5');

api.clientId = 'Twitch app client-id';

app.user.getByID({ userID: '12826' }, (err, res) => {
    if(err) {
        console.log(err);
    } else {
        console.log(res);
        /* Example response
        {
            display_name: 'Twitch',
            _id: '12826',
            name: 'twitch',
            type: 'user',
            ...
        }
        */
    }
});

api.feed.createPost({ auth: 'OAuth ...', channelID: '12826', post: 'New Post!' }, (err, res) => {
    ...
});

Feed

Twitch Doc

Function Auth Scope Required Parameters
api.feed.getPosts any (optional) channelID
api.feed.getPost any (optional) postID
api.feed.createPost channel_feed_edit auth, channelID, post
api.feed.deletePost channel_feed_edit auth, channelID, postID
api.feed.createReaction channel_feed_edit auth, channelID, postID, emoteID
api.feed.deleteReaction channel_feed_edit auth, channelID, postID, emoteID
api.feed.getComments any (optional) channelID, postID
api.feed.createComment channel_feed_edit auth, channelID, postID, comment
api.feed.deleteComment channel_feed_edit auth, channelID, postID, commentID
api.feed.createCommentReaction channel_feed_edit auth, channelID, postID, commentID, emoteID
api.feed.deleteCommentReaction channel_feed_edit auth, channelID, postID, commentID, emoteID

Channels

Twitch Doc

Function Auth Scope Required Parameters
api.channels.channel channel_read auth
api.channels.channelByID none channelID
api.channels.updateChannel channel_editor channelID, and at least one of status, game, delay or channel_feed_enabled
api.channels.editors channel_read auth, channelID
api.channels.followers none channelID
api.channels.teams none channelID
api.channels.subs channel_subscriptions auth, channelID
api.channels.checkSub channel_check_subscription auth, channelID, userID
api.channels.videos none channelID
api.channels.startAd channel_commercial auth, channelID, duration
api.channels.resetStreamKey channel_stream auth, channelID
api.channels.getCommunity none channelID
api.channels.setCommunity any auth, channelID, communityID
api.channels.leaveCommunity any auth, channelID

Chat

Twitch Doc

Function Auth Scope Required Parameters
api.chat.badges none channelID
api.chat.emoteSet none none
api.chat.emotes none none

Clips

Twitch Doc

Function Auth Scope Required Parameters
api.clips.getClip none channelName, slug
api.clips.top none none
api.clips.followed user_read none

Communities

Twitch Doc

Function Auth Scope Required Parameters
api.communities.getByName none name
api.communities.getByID none communityID
api.communities.create any auth, name, summary, description, rules
api.communities.update any (community owner) auth, communityID
api.communities.top none none
api.communities.bans any (community owner or moderator) auth, communityID
api.communities.addBan any (community owner or moderator) auth, communityID, userID
api.communities.unBan any (community owner or moderator) auth, communityID, userID
api.communities.createAvatar any (community owner) auth, communityID, avatar_image
api.communities.deleteAvatar any (community owner) auth, communityID
api.communities.createCover any (community owner) auth, communityID, cover_image
api.communities.deleteCover any (community owner) auth, communityID
api.communities.mods none communityID
api.communities.addMods any (community owner) auth, communityID, userID
api.communities.delMod any (community owner) auth, communityID, userID
api.communities.getPermissions any auth, communityID
api.communities.report none channelID, communityID
api.communities.timeouts any (community owner or moderator) auth, communityID
api.communities.addTimeout any (Owner or mod) auth, communityID, userID, duration
api.communities.delTimeout any (Owner or mod) auth, communityID, userID

Games

Twitch Doc

Function Auth Scope Required Parameters
api.games.top none none

Ingests

Twitch Doc

Function Auth Scope Required Parameters
api.ingests.serverList none none

Twitch Doc

Function Auth Scope Required Parameters
api.search.channels none query
api.search.games none query
api.search.streams none query

Streams

Twitch Doc

Function Auth Scope Required Parameters
api.streams.channel none channelID
api.streams.live none none
api.streams.summary none none
api.streams.featured none none
api.streams.followed user_read auth

Teams

Twitch Doc

Function Auth Scope Required Parameters
api.teams.getAll none none
api.teams.getTeam none team

Users

Twitch Doc

Function Auth Scope Required Parameters
api.users.user user_read auth
api.users.userByID none userID
api.users.usersByName none users
api.users.userEmotes user_subscriptions auth, userID
api.users.checkSub user_subscriptions auth, userID, channelID
api.users.follows none userID
api.users.checkFollow none userID, channelID
api.users.followChannel user_follows_edit auth, userID, channelID
api.users.unfollowChannel user_follows_edit auth, userID, channelID
api.users.blockList user_blocks_read auth, userID
api.users.blockUser user_blocks_edit auth, sourceUserID, targetUserID
api.users.unblockUser user_blocks_edit auth, sourceUserID, targetUserID
api.users.createVHS viewing_activity_read auth, identifier
api.users.checkVHS user_read auth
api.users.deleteVHS viewing_activity_read auth

Videos

Twitch Doc

Function Auth Scope Required Parameters
api.video.getVideo none videoID
api.video.top none none
api.video.followed none none

Video Upload

Twitch Doc

Function Auth Scope Required Parameters
api.videoUpload.create channel_editor auth, channelName, title
api.videoUpload.upload none videoID, part, uploadToken, videoData, contentLength
api.videoUpload.complete none videoID, uploadToken

Other

Warning: These endpoints are undocumented and should be expected to change or cease to function at any point!

Function Auth Scope Required Parameters Description
api.other.chatters none channelName Usernames of people in chat in the specified channel
api.other.hosts none channelID Channels that are hosting the specified channelID
api.other.hosting none channelID Who the specified channelID is hosting
api.other.subsTo user_subscriptions channelName Who a user is subbed to
api.other.randomStream none none Random stream
api.other.getUser none channelName Provides user data not returned in the documented endpoint
api.other.chatProperties none channelName Chat properties, such as subs only, rules etc...
api.other.product none channelName Channels subscription program details
api.other.panels none channelName Info on each of a channels panels
api.other.playlist none channelID Info on a currently running playlist
api.other.followedHosting none channelName Followed channels that are hosting someone else
api.other.followedGames none channelName Games that a user follows
api.other.followedGamesLive none channelName Live games that a user follows
api.other.checkFollowGame none channelName, game Check if a user follows a game
api.other.badges none none All chat badges
api.other.subBadges none channelID A channels sub badges
api.other.recentChat none channelID Recent chat in the specified channel
api.other.cs none none List of CS streams with extra details
api.other.csMaps none none List of CS maps and their viewers