Skip to main content

Twitch

The twitch global calls the Twitch API and listens to EventSub events for the streamer's connected channel. Breezy handles authentication, so you never deal with tokens.

Every call returns a promise.

let count = await twitch.channel.getChannelFollowerCount()

followers.textContent = count

Events​

Event functions take a callback that is called every time the event happens.

twitch.event.onChannelFollow(event => {
showAlert(event.userName + ' just followed!')
})

twitch.chat.onMessage((user, text, message) => {
addLine(user, text)
})

Pagination​

Functions that return many results take an optional pagination object and return a cursor for the next page.

type ForwardPagination = {
limit?: number
after?: string
}

type PaginatedResult<T> = {
data: Array<T>
cursor?: string
}

Reference​