Twitch is an interactive livestreaming service for content spanning gaming, entertainment, sports, music, and more.
Go to siteThe Twitch API unlocks a world of possibilities for engaging with live streaming communities and understanding audience behaviors. With Pipedream, you can harness this API to automate many aspects of Twitch interaction and analysis. From tracking stream stats to automating chat messages, the Twitch API lets you create workflows that interact with Twitch's vast live streaming ecosystem. Pipedream's serverless platform streamlines these tasks, making it simple to connect Twitch with other services for enhanced functionalities.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
twitch: {
type: "app",
app: "twitch",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.twitch.tv/helix/users`,
headers: {
Authorization: `Bearer ${this.twitch.$auth.oauth_access_token}`,
"Client-ID": `${this.twitch.$auth.oauth_client_id}`,
},
})
},
})
Automated Stream Alerts to Discord: Automatically post custom messages to a Discord channel whenever you or your favorite streamer goes live on Twitch. This keeps your community informed in real time and drives traffic to your Twitch channel.
Stream Performance Analytics: After each streaming session, aggregate statistics such as view counts, new followers, and chat activity. Send this data to Google Sheets or BigQuery for further analysis, helping you to optimize future streams based on audience engagement insights.
Automated Giveaways and Polls: During a live stream, monitor chat for certain keywords to trigger events like raffles or polls. Use Pipedream to connect Twitch chat with a randomizer service to pick winners, or tally votes, and announce results in real-time.
Blocks a user; that is, adds a specified target user to your blocks list
Checks if you are subscribed to the specified user's channel
Retrieves a list of users who follow the authenticated user. See the documentation
Twitch uses OAuth authentication. When you connect your Twitch account, Pipedream will open a popup window where you can sign into Twitch and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Twitch API.
Pipedream requests the following authorization scopes when you connect your account:
analytics:read:extensions
analytics:read:games
bits:read
channel:read:subscriptions
clips:edit
user:edit
user:edit:broadcast
user:read:broadcast
user:read:email
user:read:follows
user:read:blocked_users
user:manage:blocked_users
moderator:read:followers
channel:read:editors
channel:manage:videos
user:read:subscriptions
GET
https://id.twitch.tv/oauth2/authorize
?
client_id={{oauth.client_id}}
&
redirect_uri={{oauth.redirect_uri}}
&
state={{oauth.state}}
&
response_type=code
&
scope={{oauth.space_separated_scopes}}
POST
https://id.twitch.tv/oauth2/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
redirect_uri={{oauth.redirect_uri}}
&
grant_type=authorization_code
&
code={{oauth.code}}
POST
https://id.twitch.tv/oauth2/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
grant_type=refresh_token
&
refresh_token={{oauth.refresh_token}}