GetCreatorGoals
Get information about the broadcaster’s creator goals.
Requires: channel:read:goals scope
resp, err := client.GetCreatorGoals(ctx, "141981764")
if err != nil {
log.Fatal(err)
}
for _, goal := range resp.Data {
fmt.Printf("Goal: %s\n", goal.Description)
fmt.Printf("Type: %s\n", goal.Type)
fmt.Printf("Progress: %d / %d\n", goal.CurrentAmount, goal.TargetAmount)
fmt.Printf("Created: %s\n", goal.CreatedAt)
}
Parameters:
broadcasterID(string): The ID of the broadcaster
Response Fields:
ID(string): Goal IDBroadcasterID(string): Broadcaster’s user IDBroadcasterName(string): Broadcaster’s display nameBroadcasterLogin(string): Broadcaster’s login nameType(string): Goal type -follower,subscription,subscription_count,new_subscription, ornew_subscription_countDescription(string): Goal descriptionCurrentAmount(int): Current progress toward the goalTargetAmount(int): Target amount to complete the goalCreatedAt(time.Time): When the goal was created
Sample Response (from Twitch docs):
{
"data": [
{
"id": "1woowvbkiNv8BRxEWSqmQz6Zk92",
"broadcaster_id": "141981764",
"broadcaster_name": "TwitchDev",
"broadcaster_login": "twitchdev",
"type": "follower",
"description": "Follow goal for Helix testing",
"current_amount": 27062,
"target_amount": 30000,
"created_at": "2021-08-16T17:22:23Z"
}
]
}
Goal Types
| Type | Description |
|---|---|
follower |
Track followers |
subscription |
Track subscription revenue |
subscription_count |
Track total subscriber count |
new_subscription |
Track new subscription revenue |
new_subscription_count |
Track new subscriber count |
EventSub Integration
You can receive real-time updates when goals are created, updated, or achieved using EventSub:
channel.goal.begin- A goal is createdchannel.goal.progress- Progress is made toward a goalchannel.goal.end- A goal ends (achieved or cancelled) See EventSub documentation for more details.