# Twitch event formats

Each event in the `twitch` channel contains a [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) object in `data`. Its `details` fields depend on the event type.

## twitch.follow

A viewer followed the channel. `actor` is the follower. `data` is the event as `GET /v1/platform-events` returns it.

**Channel:** `twitch` (scope `twitch:read`)

| Field | Type | Description |
|---|---|---|
| `id` | string, `evt_…` | Publication identifier: the same when the event is delivered again from the channel history or published again. Drop repeats by `data.id`, which is also the same as in REST. |
| `type` | string, always `twitch.follow` |  |
| `subject` | string | Platform event identifier, `pevt_…`: `data.id`. |
| `dataschema` | string (URI), always [the PlatformEvent schema address](https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent) |  |
| `data` | [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) |  |

### Example

```json
{
  "specversion": "1.0",
  "id": "evt_1b6f3d82-a0c4-4e97-8b25-f3d1a7e0c486",
  "type": "twitch.follow",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "pevt_0c5e2a71-9b3d-4f86-a1e4-7d2c9b0f3a65",
  "time": "2026-11-09T10:20:11.402913Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent",
  "data": {
    "id": "pevt_0c5e2a71-9b3d-4f86-a1e4-7d2c9b0f3a65",
    "platform": "TWITCH",
    "type": "twitch.follow",
    "accountId": "141981764",
    "occurredAt": "2026-11-09T10:20:11.171067Z",
    "recordedAt": "2026-11-09T10:20:11.402913Z",
    "actor": {
      "id": "2345678",
      "login": "cool_follower",
      "displayName": "Cool_Follower",
      "avatarUrl": null
    },
    "message": null,
    "isTest": false,
    "details": {}
  }
}
```

## twitch.subscription

A viewer subscribed or shared a resubscription message. `actor` is the subscriber. One event per subscription: Donatty matches `channel.subscribe` with `channel.subscription.message` and with gift batches, which usually adds 15–25 s to a subscription without a message; a resubscription message can arrive sooner. A gifted subscription comes as `twitch.subscription.received` instead. `data` is the event as `GET /v1/platform-events` returns it.

**Channel:** `twitch` (scope `twitch:read`)

| Field | Type | Description |
|---|---|---|
| `id` | string, `evt_…` | Publication identifier: the same when the event is delivered again from the channel history or published again. Drop repeats by `data.id`, which is also the same as in REST. |
| `type` | string, always `twitch.subscription` |  |
| `subject` | string | Platform event identifier, `pevt_…`: `data.id`. |
| `dataschema` | string (URI), always [the PlatformEvent schema address](https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent) |  |
| `data` | [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) |  |

### Example

```json
{
  "specversion": "1.0",
  "id": "evt_4f8b2d05-1e63-4c79-a024-d7b9f3e6c812",
  "type": "twitch.subscription",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "pevt_3e7a1c94-0d52-4b68-9f13-c6a8e2d5b701",
  "time": "2026-11-09T10:21:30.518204Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent",
  "data": {
    "id": "pevt_3e7a1c94-0d52-4b68-9f13-c6a8e2d5b701",
    "platform": "TWITCH",
    "type": "twitch.subscription",
    "accountId": "141981764",
    "occurredAt": null,
    "recordedAt": "2026-11-09T10:21:30.518204Z",
    "actor": {
      "id": "3456789",
      "login": "cool_subscriber",
      "displayName": "Cool_Subscriber",
      "avatarUrl": null
    },
    "message": "Love the stream!",
    "isTest": false,
    "details": {
      "tier": "TIER_1",
      "cumulativeMonths": 15,
      "durationMonths": 6,
      "streakMonths": 3,
      "isResub": true
    }
  }
}
```

## twitch.subscription.gift

A viewer gifted one or more subscriptions to the community. `actor` is the gifter, `null` when anonymous. Matching with the recipients usually adds 15–25 s. `data` is the event as `GET /v1/platform-events` returns it.

**Channel:** `twitch` (scope `twitch:read`)

| Field | Type | Description |
|---|---|---|
| `id` | string, `evt_…` | Publication identifier: the same when the event is delivered again from the channel history or published again. Drop repeats by `data.id`, which is also the same as in REST. |
| `type` | string, always `twitch.subscription.gift` |  |
| `subject` | string | Platform event identifier, `pevt_…`: `data.id`. |
| `dataschema` | string (URI), always [the PlatformEvent schema address](https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent) |  |
| `data` | [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) |  |

### Example

```json
{
  "specversion": "1.0",
  "id": "evt_6b0d4f27-3a85-4e9b-c146-f9d1b5a8e034",
  "type": "twitch.subscription.gift",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "pevt_5a9c3e16-2f74-4d8a-b035-e8c0a4f7d923",
  "time": "2026-11-09T10:22:47.091355Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent",
  "data": {
    "id": "pevt_5a9c3e16-2f74-4d8a-b035-e8c0a4f7d923",
    "platform": "TWITCH",
    "type": "twitch.subscription.gift",
    "accountId": "141981764",
    "occurredAt": null,
    "recordedAt": "2026-11-09T10:22:47.091355Z",
    "actor": {
      "id": "1234567",
      "login": "cool_gifter",
      "displayName": "Cool_Gifter",
      "avatarUrl": null
    },
    "message": null,
    "isTest": false,
    "details": {
      "tier": "TIER_1",
      "count": 5,
      "cumulativeCount": 284,
      "isAnonymous": false
    }
  }
}
```

## twitch.subscription.received

A viewer received a gifted subscription: one event per recipient. `actor` and `details.recipient` are the recipient; `details.gifter` is the gifter when Donatty could match the gift batch, otherwise `null`. Matching usually adds 15–25 s. `data` is the event as `GET /v1/platform-events` returns it.

**Channel:** `twitch` (scope `twitch:read`)

| Field | Type | Description |
|---|---|---|
| `id` | string, `evt_…` | Publication identifier: the same when the event is delivered again from the channel history or published again. Drop repeats by `data.id`, which is also the same as in REST. |
| `type` | string, always `twitch.subscription.received` |  |
| `subject` | string | Platform event identifier, `pevt_…`: `data.id`. |
| `dataschema` | string (URI), always [the PlatformEvent schema address](https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent) |  |
| `data` | [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) |  |

### Example

```json
{
  "specversion": "1.0",
  "id": "evt_9e3a7c50-6db8-4a0c-9479-2c04e8d1b367",
  "type": "twitch.subscription.received",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "pevt_8d2f6b49-5ca7-4fbd-8368-1bf3d7c0a256",
  "time": "2026-11-09T10:22:47.284719Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent",
  "data": {
    "id": "pevt_8d2f6b49-5ca7-4fbd-8368-1bf3d7c0a256",
    "platform": "TWITCH",
    "type": "twitch.subscription.received",
    "accountId": "141981764",
    "occurredAt": null,
    "recordedAt": "2026-11-09T10:22:47.284719Z",
    "actor": {
      "id": "4567890",
      "login": "lucky_viewer",
      "displayName": "Lucky_Viewer",
      "avatarUrl": null
    },
    "message": null,
    "isTest": false,
    "details": {
      "recipient": {
        "id": "4567890",
        "login": "lucky_viewer",
        "displayName": "Lucky_Viewer",
        "avatarUrl": null
      },
      "gifter": {
        "id": "1234567",
        "login": "cool_gifter",
        "displayName": "Cool_Gifter",
        "avatarUrl": null
      },
      "tier": "TIER_1"
    }
  }
}
```

## twitch.cheer

A viewer cheered with bits. `actor` is the viewer, `null` when anonymous. Bits are not money and are not counted in top donors, totals or goals. `data` is the event as `GET /v1/platform-events` returns it.

**Channel:** `twitch` (scope `twitch:read`)

| Field | Type | Description |
|---|---|---|
| `id` | string, `evt_…` | Publication identifier: the same when the event is delivered again from the channel history or published again. Drop repeats by `data.id`, which is also the same as in REST. |
| `type` | string, always `twitch.cheer` |  |
| `subject` | string | Platform event identifier, `pevt_…`: `data.id`. |
| `dataschema` | string (URI), always [the PlatformEvent schema address](https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent) |  |
| `data` | [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) |  |

### Example

```json
{
  "specversion": "1.0",
  "id": "evt_a04b8d61-7ec9-4b1d-a58a-3d15f9e2c478",
  "type": "twitch.cheer",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "pevt_7c1e5a38-4196-4fac-9257-0ae2c6b9f145",
  "time": "2026-11-09T10:24:05.733018Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent",
  "data": {
    "id": "pevt_7c1e5a38-4196-4fac-9257-0ae2c6b9f145",
    "platform": "TWITCH",
    "type": "twitch.cheer",
    "accountId": "141981764",
    "occurredAt": null,
    "recordedAt": "2026-11-09T10:24:05.733018Z",
    "actor": {
      "id": "5678901",
      "login": "cool_cheerer",
      "displayName": "Cool_Cheerer",
      "avatarUrl": null
    },
    "message": "Cheer100 pogchamp",
    "isTest": false,
    "details": {
      "bits": {
        "unit": "BITS",
        "quantity": 100
      },
      "isAnonymous": false
    }
  }
}
```

## twitch.raid

Another channel raided this one. `actor` and `details.fromAccount` are the raiding channel. `data` is the event as `GET /v1/platform-events` returns it.

**Channel:** `twitch` (scope `twitch:read`)

| Field | Type | Description |
|---|---|---|
| `id` | string, `evt_…` | Publication identifier: the same when the event is delivered again from the channel history or published again. Drop repeats by `data.id`, which is also the same as in REST. |
| `type` | string, always `twitch.raid` |  |
| `subject` | string | Platform event identifier, `pevt_…`: `data.id`. |
| `dataschema` | string (URI), always [the PlatformEvent schema address](https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent) |  |
| `data` | [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) |  |

### Example

```json
{
  "specversion": "1.0",
  "id": "evt_c26daf83-9a0b-4d3f-87ac-5f37b1a4e690",
  "type": "twitch.raid",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "pevt_b15c9e72-8fda-4c2e-b69b-4e26a0f3d589",
  "time": "2026-11-09T10:25:40.017462Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent",
  "data": {
    "id": "pevt_b15c9e72-8fda-4c2e-b69b-4e26a0f3d589",
    "platform": "TWITCH",
    "type": "twitch.raid",
    "accountId": "141981764",
    "occurredAt": null,
    "recordedAt": "2026-11-09T10:25:40.017462Z",
    "actor": {
      "id": "6789012",
      "login": "cool_raider",
      "displayName": "Cool_Raider",
      "avatarUrl": null
    },
    "message": null,
    "isTest": false,
    "details": {
      "fromAccount": {
        "id": "6789012",
        "login": "cool_raider",
        "displayName": "Cool_Raider"
      },
      "viewerCount": 42
    }
  }
}
```

## twitch.reward.redeemed

A viewer redeemed a custom channel points reward. `actor` is the viewer. `data` is the event as `GET /v1/platform-events` returns it.

**Channel:** `twitch` (scope `twitch:read`)

| Field | Type | Description |
|---|---|---|
| `id` | string, `evt_…` | Publication identifier: the same when the event is delivered again from the channel history or published again. Drop repeats by `data.id`, which is also the same as in REST. |
| `type` | string, always `twitch.reward.redeemed` |  |
| `subject` | string | Platform event identifier, `pevt_…`: `data.id`. |
| `dataschema` | string (URI), always [the PlatformEvent schema address](https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent) |  |
| `data` | [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) |  |

### Example

```json
{
  "specversion": "1.0",
  "id": "evt_e48fc1a5-bc2d-4f51-a9ce-7159d3c6a8b2",
  "type": "twitch.reward.redeemed",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "pevt_d37eb094-ab1c-4e40-98bd-6048c2b5f7a1",
  "time": "2026-11-09T10:27:12.640185Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent",
  "data": {
    "id": "pevt_d37eb094-ab1c-4e40-98bd-6048c2b5f7a1",
    "platform": "TWITCH",
    "type": "twitch.reward.redeemed",
    "accountId": "141981764",
    "occurredAt": "2026-11-09T10:27:12.391204Z",
    "recordedAt": "2026-11-09T10:27:12.640185Z",
    "actor": {
      "id": "7890123",
      "login": "cool_viewer",
      "displayName": "Cool_Viewer",
      "avatarUrl": null
    },
    "message": null,
    "isTest": false,
    "details": {
      "redemptionId": "17fa2df1-ad76-4804-bfa5-a40ef63efe63",
      "rewardId": "92af127c-7326-4483-a52b-b0da0be61c01",
      "title": "Hydrate",
      "cost": {
        "unit": "CHANNEL_POINTS",
        "quantity": 500
      },
      "userInput": "Drink some water"
    }
  }
}
```

## twitch.hype_train.level_changed

A hype train started (its first level) or reached a new level. The end of a train is not sent. `actor` is `null`. `data` is the event as `GET /v1/platform-events` returns it.

**Channel:** `twitch` (scope `twitch:read`)

| Field | Type | Description |
|---|---|---|
| `id` | string, `evt_…` | Publication identifier: the same when the event is delivered again from the channel history or published again. Drop repeats by `data.id`, which is also the same as in REST. |
| `type` | string, always `twitch.hype_train.level_changed` |  |
| `subject` | string | Platform event identifier, `pevt_…`: `data.id`. |
| `dataschema` | string (URI), always [the PlatformEvent schema address](https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent) |  |
| `data` | [`PlatformEvent`](https://developers.donatty.com/en/structures/platform-event.md#platformevent) |  |

### Example

```json
{
  "specversion": "1.0",
  "id": "evt_06a1e3c7-de4f-4b73-8be1-937bf5e8cad4",
  "type": "twitch.hype_train.level_changed",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "pevt_f590d2b6-cd3e-4a62-bad0-826ae4d7b9c3",
  "time": "2026-11-09T10:28:03.205873Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/PlatformEvent",
  "data": {
    "id": "pevt_f590d2b6-cd3e-4a62-bad0-826ae4d7b9c3",
    "platform": "TWITCH",
    "type": "twitch.hype_train.level_changed",
    "accountId": "141981764",
    "occurredAt": "2026-11-09T10:28:02.948311Z",
    "recordedAt": "2026-11-09T10:28:03.205873Z",
    "actor": null,
    "message": null,
    "isTest": false,
    "details": {
      "trainId": "1b0AsbInCHZW2SQFQkCzqN07Ib2",
      "level": 2
    }
  }
}
```
