Learn about the APIs that provide data about Twitch’s content and social graph, as well as how you can leverage this information to help streamers succeed on Twitch.
Olivia Grace, Product Manager of Social, Twitch
2. #TwitchDevDay
Using Twitch
Data
Enrich your offering and create more
interactive and powerful experiences
Combine game data (Deep Metadata API) and
social data (Friends API, Presence API) to build
unique extensions
1
2
5. #TwitchDevDay
Game play, non game play, Pack opening
Hero (class, name, type)
Game mode: Casual, Ranked (exact rank),
Arena (number of wins), Tavern Brawl
(number of wins for Heroic)
Game play, non game play
Hero (ability, name, role)
What is the Deep Metadata API?
Real-time, timestamped game metadata from live streams
using computer vision technology
6. How Do We Use Metadata at Twitch?
Game Directory Filters
8. #TwitchDevDay
How Can You Use the
Deep Metadata API?
Richer interactions in your analytics apps,
creator profile, player overlays or other
extensions.
Gather data about creators:
Which heroes do they play? How
often? From which heroes do they
most often lose?
How many times did they win in the
last week?
How do they rank?
Which game mode do they play
most?
9. #TwitchDevDay
How to Use the Deep Metadata API
Sample Call
curl -H 'Client-ID: <your Client-ID>'
-X GET 'https://api.twitch.tv/helix/streams/metadata'
10. #TwitchDevDay
Sample Response
Using the Deep
Metadata API
{"data":
[
{
"user_id":"1564968",
"game_id":"138585",
"overwatch":null,
"hearthstone":{
"broadcaster":{
"hero":{
"type":"Classic hero",
"class":"Shaman",
"name":"Thrall"
}
},
"opponent":{
"hero":{
"type":"Classic hero",
"class":"Warrior",
"name":"Garrosh Hellscream"
}
}
}
},
. . .
],
}
11. #TwitchDevDay
What’s Coming Up
Support for VOD
More games, more metadata
types!
Which game would you
like to see next?
What type of metadata
is useful to you?
13. #TwitchDevDay
Basic CRUD service
Manages relationship between users
No relationship
Pending request in either direction
Friendship
Handles around 8,000 requests per second
Separate but related API Endpoints
What is the Friends API?
14. #TwitchDevDay
Manages state from all your open sessions
Attempts to smartly determine what a user is
doing from all this session information
Streaming, Watching, Playing
Presence handles around 900 requests per
second
75% of these are writes, as it’s based
on a heartbeat.
Presence Experimentation
Separate but related API Endpoints
What is the Presence API?
15. #TwitchDevDay
Presence API Flow
Sends user status via websocket to our Android and iOS apps, the
website, and the Desktop App.
Can also send to third parties
Receives status from those platforms as heartbeats via API
Can also receive from third parties
16. #TwitchDevDay
What could you do with the system?
How can you use Friends?
Gather Friendships to power your system
Who are these users’ friends?
What are they doing with your
systems?
Could new friendships be created to
leverage social gaming?
Create new friendships in the Twitch Friends
system
Could users add friends via your
platform?
17. #TwitchDevDay
How best to use the system
Friends API Best Practices
Two-way usage - if you’re going to read/utilize
friends, we’d love it if you’re adding
friendships too.
Don’t use our system to power a distinct
system without returning any value.
18. #TwitchDevDay
Read Presence
What are users on the site doing right
now?
What are a specific set of users doing
right now?
Write Presence
What presence states could I send
back to show to other users?
Streaming: <game>
Playing: <game>, <additional game
context>
Watching: <channel> (hosted),
<game>
What could you do with the system?
How can you use Presence?
19. #TwitchDevDay
Write as well as reading
Create Friendships
Use the richness of the statuses Presence
offers!
How best to use the system
Presence Best Practices
20. #TwitchDevDay
In Conclusion…
Friends and Presence are powerful systems to
leverage the social nature of gaming.
The Deep Metadata API enables you to create
rich experiences with the power of live game
metadata.
1
2