Socket
Socket
Sign inDemoInstall

twitch-api-v5

Package Overview
Dependencies
48
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    twitch-api-v5

Module for Twitch's v5 API


Version published
Weekly downloads
45
decreased by-13.46%
Maintainers
1
Install size
3.81 MB
Created
Weekly downloads
 

Readme

Source

Twitch_API_v5

Simple module to use Twitch's API v5 for all endpoints. 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
  • Authentication
  • Bits
  • Feed
  • Channels
  • Chat
  • Clips
  • Collections
  • Communities
  • Games
  • Ingests
  • Search
  • Streams
  • Teams
  • Users
  • Videos
  • Video Upload
  • Other

Getting Started

Install
npm install twitch-api-v5 --save
Examples
var api = require('twitch-api-v5');

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

api.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) => {
    ...
});

To enable debugging of the HTTP requests, use api.debug = true;


Authentication

Twitch Doc

Note: The authorization code needed for getAccessToken is obtained by steps 1 and 2 of the Authorization Code Flow described in the Twitch Docs.

FunctionAuth ScopeRequired Parameters
api.auth.getAccessTokennoneclientSecret, redirectURI, code
api.auth.checkTokenanyauth
api.auth.refreshTokennoneclientSecret, refreshToken

Bits

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.bits.cheermotesnonenone

Feed

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.feed.getPostsany (optional)channelID
api.feed.getPostany (optional)postID
api.feed.createPostchannel_feed_editauth, channelID, post
api.feed.deletePostchannel_feed_editauth, channelID, postID
api.feed.createReactionchannel_feed_editauth, channelID, postID, emoteID
api.feed.deleteReactionchannel_feed_editauth, channelID, postID, emoteID
api.feed.getCommentsany (optional)channelID, postID
api.feed.createCommentchannel_feed_editauth, channelID, postID, comment
api.feed.deleteCommentchannel_feed_editauth, channelID, postID, commentID
api.feed.createCommentReactionchannel_feed_editauth, channelID, postID, commentID, emoteID
api.feed.deleteCommentReactionchannel_feed_editauth, channelID, postID, commentID, emoteID

Channels

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.channels.channelchannel_readauth
api.channels.channelByIDnonechannelID
api.channels.updateChannelchannel_editorchannelID, and at least one of status, game, delay or channel_feed_enabled
api.channels.editorschannel_readauth, channelID
api.channels.followersnonechannelID
api.channels.teamsnonechannelID
api.channels.subschannel_subscriptionsauth, channelID
api.channels.checkSubchannel_check_subscriptionauth, channelID, userID
api.channels.videosnonechannelID
api.channels.startAdchannel_commercialauth, channelID, duration
api.channels.resetStreamKeychannel_streamauth, channelID
api.channels.getCommunitynonechannelID
api.channels.setCommunitychannel_editorauth, channelID, communityID
api.channels.leaveCommunitychannel_editorauth, channelID

Chat

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.chat.badgesnonechannelID
api.chat.emoteSetnonenone
api.chat.emotesnonenone

Clips

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.clips.getClipnoneslug
api.clips.topnonenone
api.clips.followeduser_readauth

Collections

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.collections.getMetadatanonecollectionID
api.collections.getCollectionnonecollectionID
api.collections.getByChannelnonechannelID
api.collections.createcollections_editauth, channelID, title
api.collections.updatecollections_editauth, collectionID, title
api.collections.createThumbnailcollections_editauth, collectionID, itemID
api.collections.deletecollections_editauth, collectionID
api.collections.addItemcollections_editauth, collectionID, videoID
api.collections.delItemcollections_editauth, collectionID, itemID
api.collections.moveItemcollections_editauth, collectionID, itemID, position

Communities

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.communities.getByNamenonename
api.communities.getByIDnonecommunityID
api.communities.updatecommunities_editauth, communityID
api.communities.topnonenone
api.communities.banscommunities_moderateauth, communityID
api.communities.addBancommunities_moderateauth, communityID, userID
api.communities.unBancommunities_moderateauth, communityID, userID
api.communities.createAvatarcommunities_editauth, communityID, avatar_image
api.communities.deleteAvatarcommunities_editauth, communityID
api.communities.createCovercommunities_editauth, communityID, cover_image
api.communities.deleteCovercommunities_editauth, communityID
api.communities.modscommunities_editauth, communityID
api.communities.addModcommunities_editauth, communityID, userID
api.communities.delModcommunities_editauth, communityID, userID
api.communities.getPermissionsanyauth, communityID
api.communities.reportnonechannelID, communityID
api.communities.timeoutscommunities_moderateauth, communityID
api.communities.addTimeoutcommunities_moderateauth, communityID, userID, duration
api.communities.delTimeoutcommunities_moderateauth, communityID, userID

Games

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.games.topnonenone

Ingests

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.ingests.serverListnonenone

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.search.channelsnonequery
api.search.gamesnonequery
api.search.streamsnonequery

Streams

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.streams.channelnonechannelID
api.streams.livenonenone
api.streams.summarynonenone
api.streams.featurednonenone
api.streams.followeduser_readauth

Teams

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.teams.getAllnonenone
api.teams.getTeamnoneteam

Users

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.users.useruser_readauth
api.users.userByIDnoneuserID
api.users.usersByNamenoneusers
api.users.userEmotesuser_subscriptionsauth, userID
api.users.checkSubuser_subscriptionsauth, userID, channelID
api.users.followsnoneuserID
api.users.checkFollownoneuserID, channelID
api.users.followChanneluser_follows_editauth, userID, channelID
api.users.unfollowChanneluser_follows_editauth, userID, channelID
api.users.blockListuser_blocks_readauth, userID
api.users.blockUseruser_blocks_editauth, sourceUserID, targetUserID
api.users.unblockUseruser_blocks_editauth, sourceUserID, targetUserID
api.users.createVHSviewing_activity_readauth, identifier
api.users.checkVHSuser_readauth
api.users.deleteVHSviewing_activity_readauth

Videos

Twitch Doc

FunctionAuth ScopeRequired Parameters
api.videos.getVideononevideoID
api.videos.topnonenone
api.videos.followednonenone
api.videos.createchannel_editorauth, channelID, title
api.videos.uploadnonecontent-length, videoData, videoID, part, token
api.videos.completenonevideoID, token
api.videos.updatechannel_editorauth, videoID
api.videos.deletechannel_editorauth, videoID

Other

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

FunctionAuth ScopeRequired ParametersDescription
api.other.chattersnonechannelNameUsernames of people in chat in the specified channel
api.other.hostsnonechannelIDChannels that are hosting the specified channelID
api.other.hostingnonechannelIDWho the specified channelID is hosting
api.other.subsTouser_subscriptionsauth, channelNameWho a user is subbed to
api.other.randomStreamnonenoneRandom stream
api.other.getUsernonechannelNameProvides user data not returned in the documented endpoint
api.other.chatPropertiesnonechannelNameChat properties, such as subs only, rules etc...
api.other.productnonechannelNameChannels subscription program details
api.other.panelsnonechannelNameInfo on each of a channels panels
api.other.playlistnonechannelIDInfo on a currently running playlist
api.other.followedHostingnonechannelNameFollowed channels that are hosting someone else
api.other.followedGamesnonechannelNameGames that a user follows
api.other.followedGamesLivenonechannelNameLive games that a user follows
api.other.checkFollowGamenonechannelName, gameCheck if a user follows a game
api.other.badgesnonenoneAll chat badges
api.other.subBadgesnonechannelIDA channels sub badges
api.other.recentChatnonechannelIDRecent chat in the specified channel
api.other.csnonenoneList of CS streams with extra details
api.other.csMapsnonenoneList of CS maps and their viewers

Keywords

FAQs

Last updated on 05 Jul 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc