Skip to content

Commit 2803142

Browse files
mintlify[bot]tcaldwell-x
authored andcommitted
docs: add broadcast.start and broadcast.end events to X Activity API
1 parent fa37826 commit 2803142

2 files changed

Lines changed: 123 additions & 4 deletions

File tree

x-api/activity/event-payloads.mdx

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,6 +2044,120 @@ Fired when the filtered user unblocks another user.
20442044

20452045
## Broadcast events
20462046

2047+
### `broadcast.start`
2048+
2049+
Fired when a user starts a live broadcast. Public event — can be subscribed to with either app-only or user-context authentication. The `payload` includes the host `user` and the `broadcast_id`.
2050+
2051+
```json title="broadcast.start" expandable lines wrap icon="/icons/xds/icon-brackets.svg"
2052+
{
2053+
"data": {
2054+
"event_uuid": "4093201169289922042",
2055+
"filter": {
2056+
"user_id": "1111111111111111111"
2057+
},
2058+
"event_type": "broadcast.start",
2059+
"tag": "broadcast-start",
2060+
"payload": {
2061+
"user": {
2062+
"data": {
2063+
"affiliation": {
2064+
"description": "X",
2065+
"badge_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg",
2066+
"url": "https://twitter.com/X"
2067+
},
2068+
"location": "San Francisco, CA",
2069+
"name": "Example User",
2070+
"profile_image_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg",
2071+
"created_at": "2023-10-23T13:44:53.000Z",
2072+
"protected": false,
2073+
"verified": true,
2074+
"url": "https://t.co/xxxxxxxx",
2075+
"public_metrics": {
2076+
"followers_count": 5502,
2077+
"followers_count_str": "5502",
2078+
"following_count": 651,
2079+
"following_count_str": "651",
2080+
"tweet_count": 789,
2081+
"tweet_count_str": "789",
2082+
"listed_count": 46,
2083+
"listed_count_str": "46",
2084+
"like_count": 8010,
2085+
"like_count_str": "8010",
2086+
"media_count": 79,
2087+
"media_count_str": "79"
2088+
},
2089+
"is_identity_verified": true,
2090+
"description": "Building with the X AnotherUser @XDevelopers",
2091+
"verified_type": "blue",
2092+
"profile_banner_url": "https://pbs.twimg.com/profile_banners/1111111111111111111/1600000000",
2093+
"username": "ExampleUser",
2094+
"id": "1111111111111111111"
2095+
}
2096+
},
2097+
"broadcast_id": "1mGPaZaAdNqJN",
2098+
"event_type": "broadcast_start"
2099+
}
2100+
}
2101+
}
2102+
```
2103+
2104+
### `broadcast.end`
2105+
2106+
Fired when a user ends a live broadcast. Public event — can be subscribed to with either app-only or user-context authentication. Same shape as `broadcast.start` with an inner `event_type` of `broadcast_end`.
2107+
2108+
```json title="broadcast.end" expandable lines wrap icon="/icons/xds/icon-brackets.svg"
2109+
{
2110+
"data": {
2111+
"event_uuid": "-498317022904955632",
2112+
"filter": {
2113+
"user_id": "1111111111111111111"
2114+
},
2115+
"event_type": "broadcast.end",
2116+
"tag": "broadcast-end",
2117+
"payload": {
2118+
"user": {
2119+
"data": {
2120+
"affiliation": {
2121+
"description": "X",
2122+
"badge_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg",
2123+
"url": "https://twitter.com/X"
2124+
},
2125+
"location": "San Francisco, CA",
2126+
"name": "Example User",
2127+
"profile_image_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg",
2128+
"created_at": "2023-10-23T13:44:53.000Z",
2129+
"protected": false,
2130+
"verified": true,
2131+
"url": "https://t.co/xxxxxxxx",
2132+
"public_metrics": {
2133+
"followers_count": 5502,
2134+
"followers_count_str": "5502",
2135+
"following_count": 651,
2136+
"following_count_str": "651",
2137+
"tweet_count": 789,
2138+
"tweet_count_str": "789",
2139+
"listed_count": 46,
2140+
"listed_count_str": "46",
2141+
"like_count": 8010,
2142+
"like_count_str": "8010",
2143+
"media_count": 79,
2144+
"media_count_str": "79"
2145+
},
2146+
"is_identity_verified": true,
2147+
"description": "Building with the X AnotherUser @XDevelopers",
2148+
"verified_type": "blue",
2149+
"profile_banner_url": "https://pbs.twimg.com/profile_banners/1111111111111111111/1600000000",
2150+
"username": "ExampleUser",
2151+
"id": "1111111111111111111"
2152+
}
2153+
},
2154+
"broadcast_id": "1mGPaZaAdNqJN",
2155+
"event_type": "broadcast_end"
2156+
}
2157+
}
2158+
}
2159+
```
2160+
20472161
### `broadcast.chat`
20482162

20492163
Fired when the filtered user receives a chat message in a broadcast that they own. Private event — requires user-context authentication with the `broadcast.read` scope. The `payload` includes the `broadcast_id`, the chat `message_id` and `message` text, and an `author` block with the sending user's profile.

x-api/activity/introduction.mdx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,17 @@ Block events are triggered when the filtered user blocks or unblocks another use
162162

163163
### Broadcast events
164164

165-
Broadcast events are triggered when the filtered user receives a chat message in a broadcast that they own.
165+
Broadcast events are triggered when the filtered user starts or ends a live broadcast, or receives a chat message in a broadcast that they own.
166166

167-
| Event Name | Description | Filters |
168-
| ---------------- | -------------------------------------------------------------------------------------- | --------- |
169-
| `broadcast.chat` | Fired when the filtered user receives a chat message in a broadcast that they own | `user_id` |
167+
| Event Name | Description | Filters |
168+
| ----------------- | -------------------------------------------------------------------------------------- | --------- |
169+
| `broadcast.start` | Fired when a user starts a live broadcast | `user_id` |
170+
| `broadcast.end` | Fired when a user ends a live broadcast | `user_id` |
171+
| `broadcast.chat` | Fired when the filtered user receives a chat message in a broadcast that they own | `user_id` |
170172

171173
<Note>
174+
**Public events:** `broadcast.start` and `broadcast.end` are public events and can be subscribed to with either app-only or user-context authentication.
175+
172176
**Private event:** `broadcast.chat` is a private event and requires user-context (OAuth 2.0) authentication with the `broadcast.read` scope. See [Event privacy and authentication](#event-privacy-and-authentication) below.
173177
</Note>
174178

@@ -193,6 +197,7 @@ Public events are activities that a public user account performs publicly that a
193197
**Current public events:**
194198
- Profile updates (bio, picture, banner, location, URL, username changes)
195199
- Post creation (`post.create`) and deletion (`post.delete`)
200+
- Broadcast start (`broadcast.start`) and end (`broadcast.end`)
196201

197202
For these public events, you can create subscriptions by specifying the user ID in your filter and receive them via XAA.
198203

0 commit comments

Comments
 (0)