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
- Feed
- Channels
- Chat
- Clips
- 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) => {
...
});
Feed
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
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 | channel_editor | auth, channelID, communityID |
api.channels.leaveCommunity | channel_editor | auth, channelID |
Chat
Function | Auth Scope | Required Parameters |
---|---|---|
api.chat.badges | none | channelID |
api.chat.emoteSet | none | none |
api.chat.emotes | none | none |
Clips
Function | Auth Scope | Required Parameters |
---|---|---|
api.clips.getClip | none | channelName, slug |
api.clips.top | none | none |
api.clips.followed | user_read | none |
Communities
Function | Auth Scope | Required Parameters |
---|---|---|
api.communities.getByName | none | name |
api.communities.getByID | none | communityID |
api.communities.update | communities_edit | auth, communityID |
api.communities.top | none | none |
api.communities.bans | communities_moderate | auth, communityID |
api.communities.addBan | communities_moderate | auth, communityID, userID |
api.communities.unBan | communities_moderate | auth, communityID, userID |
api.communities.createAvatar | communities_edit | auth, communityID, avatar_image |
api.communities.deleteAvatar | communities_edit | auth, communityID |
api.communities.createCover | communities_edit | auth, communityID, cover_image |
api.communities.deleteCover | communities_edit | auth, communityID |
api.communities.mods | communities_edit | auth, communityID |
api.communities.addMods | communities_edit | auth, communityID, userID |
api.communities.delMod | communities_edit | auth, communityID, userID |
api.communities.getPermissions | any | auth, communityID |
api.communities.report | none | channelID, communityID |
api.communities.timeouts | communities_moderate | auth, communityID |
api.communities.addTimeout | communities_moderate | auth, communityID, userID, duration |
api.communities.delTimeout | communities_moderate | auth, communityID, userID |
Games
Function | Auth Scope | Required Parameters |
---|---|---|
api.games.top | none | none |
Ingests
Example
api.ingests.({ }, (err, res) => {
...
});
Function | Auth Scope | Required Parameters |
---|---|---|
api.ingests.serverList | none | none |
Search
Example
api.search.({ }, (err, res) => {
...
});
Function | Auth Scope | Required Parameters |
---|---|---|
api.search.channels | none | query |
api.search.games | none | query |
api.search.streams | none | query |
Streams
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
Function | Auth Scope | Required Parameters |
---|---|---|
api.teams.getAll | none | none |
api.teams.getTeam | none | team |
Users
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
Function | Auth Scope | Required Parameters |
---|---|---|
api.video.getVideo | none | videoID |
api.video.top | none | none |
api.video.followed | none | none |
Video Upload
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.checkToken | any | auth | Checks the validity, username, client-id and scopes of a token |
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 | auth, 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 |