|
| 1 | +--- |
| 2 | +id: chatbot-counters |
| 3 | +sidebar_label: "Counters" |
| 4 | +description: "Real-time updates for StreamElements chatbot counter values via the Astro Websocket Gateway" |
| 5 | +tags: |
| 6 | +- api |
| 7 | +- websockets |
| 8 | +- real-time |
| 9 | +- chatbot |
| 10 | +- counters |
| 11 | +keywords: |
| 12 | +- chatbot counters |
| 13 | +- streamelements counter |
| 14 | +- counter updates |
| 15 | +- real-time counter |
| 16 | +- bot counter |
| 17 | +--- |
| 18 | + |
| 19 | +# Chatbot Counters |
| 20 | + |
| 21 | +## Topic |
| 22 | + |
| 23 | +`channel.chatbot.counters` |
| 24 | + |
| 25 | +## Description |
| 26 | + |
| 27 | +This event is triggered whenever a chatbot counter value changes, whether through increment, decrement, or reset operations. It provides real-time updates of counter values, enabling immediate synchronization across your applications. |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +Subscribe to this topic to receive real-time notifications about changes to your chatbot counters. This is particularly useful for maintaining accurate counter displays in overlays, applications, or other integrations that need to reflect the current state of your chatbot counters. |
| 32 | + |
| 33 | +## Payload |
| 34 | + |
| 35 | +```json |
| 36 | +{ |
| 37 | + "id": "01HB0YF39XF16HMHCPDYZYJYFL", |
| 38 | + "ts": "2023-09-23T12:10:25Z", |
| 39 | + "type": "message", |
| 40 | + "topic": "channel.chatbot.counters", |
| 41 | + "data": { |
| 42 | + "counter": "deaths", |
| 43 | + "value": 42 |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +### Parameters |
| 49 | + |
| 50 | +| Parameter | Type | Description | |
| 51 | +| -------------- | -------- | ----------------------------------------------------------- | |
| 52 | +| `data.counter` | `string` | The name of the counter that was updated | |
| 53 | +| `data.value` | `number` | The current value of the counter after the update operation | |
| 54 | + |
| 55 | +## Examples |
| 56 | + |
| 57 | +### Subscription Request |
| 58 | + |
| 59 | +```json |
| 60 | +{ |
| 61 | + "type": "subscribe", |
| 62 | + "nonce": "86ccb2b3-eb8d-4b3c-902d-509c3f5ca88c", |
| 63 | + "data": { |
| 64 | + "topic": "channel.chatbot.counters", |
| 65 | + "room": "channelId123", |
| 66 | + "token": "YOUR_JWT_TOKEN", |
| 67 | + "token_type": "jwt" |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +## Related Topics |
| 73 | + |
| 74 | +- [Chatbot Status](./chatbot-status.md) - Chatbot connection status |
| 75 | +- [Timeout](./timeout.md) - User timeout notifications |
| 76 | +- [Websockets](../../index.md) - General information about the Astro Websocket Gateway |
0 commit comments