Skip to content

Commit d9d437d

Browse files
committed
apply chat integrations doc fixes
1 parent 9afe270 commit d9d437d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/pages/docs/chat/integrations.mdx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ To convert a Pub/Sub message to a Chat message you can use the table below:
1717

1818
| Ably Message Field | Chat Message Field | Transformation/Notes |
1919
|-------------------|-------------------|---------------------|
20-
| `clientId` | `clientId` | Direct mapping with empty string default |
21-
| `timestamp` | `timestamp` | In Pub/Sub it's a unix timestamp in milliseconds since the epoch. In Chat it's a Date object. |
22-
| `serial` | `serial` | Direct mapping with empty string default |
20+
| `clientId` | `clientId` | Direct mapping. |
21+
| `timestamp` | `timestamp` | In Pub/Sub, this is a UNIX timestamp in milliseconds since the epoch. In Chat, this is a Date object. |
22+
| `serial` | `serial` | Direct mapping. |
2323
| `data.text` | `text` | Data must be JSON-decoded first. |
2424
| `data.metadata` | `metadata` | Data must be JSON-decoded first. |
2525
| `extras.headers` | `headers` | Flat object, key-value pairs. |
@@ -34,12 +34,9 @@ If you are using a language that has an Ably Pub/Sub SDK, you can use the `fromE
3434

3535
If you are not using a language supported by an Ably Pub/Sub SDK, you will need to manually decode the message.
3636

37-
### Things to be aware of
37+
Be aware that message actions are numeric values over the realtime channels, Pub/Sub REST API, and in integrations. Ably SDKs convert these numeric values to the corresponding string representations. If you do not use an Ably SDK, you will need to convert the numerical action values to their string representations.
3838

39-
- Chat Messages have an `action` that is one of: `message.created` (numeric value `0`), `message.updated` (numeric value `1`), or `message.deleted` (numeric value `2`).The Chat SDK treats annotation summaries as a separate concept at the moment, but in Pub/Sub they are a complete message with the `action` set to `message.summary` (numeric value `4`).
40-
- [Message actions](https://sdk.ably.com/builds/ably/specification/main/features/#TM5) are numeric values over the realtime channels, Pub/Sub REST API, and in integrations. Ably SDKs convert these numeric values to the corresponding string representations. If you do not use an Ably SDK, you will need to convert the numerical action values to their string representations.
41-
- If possible, use an Ably Pub/Sub SDK with `fromEncoded()` or `fromEncodedArray()` to decode the message. This will ensure that the message is decoded correctly and all the fields are present, as well as convert things like numerical action values to their string representations. Details on how to do this are available in the [platform integrations documentation](/docs/platform/integrations/webhooks).
42-
- Message reaction summaries are always sent with the message, so you can use the `annotations.summary` field to get the reaction summaries, even if the action is not `message.summary`.
39+
If possible, use an Ably Pub/Sub SDK with `fromEncoded()` or `fromEncodedArray()` to decode the message. This will ensure that the message is decoded correctly and all the fields are present, as well as convert things like numerical action values to their string representations. Details on how to do this are available in the [platform integrations documentation](/docs/platform/integrations/webhooks).
4340

4441
### Is this message new, updated, or deleted?
4542

@@ -65,4 +62,4 @@ Message reactions are a Chat feature based on the Pub/Sub [annotations](/docs/me
6562

6663
Messages arriving from the realtime channel or integrations will show the annotation type under `message.annotations.summary`. The Chat SDKs automatically map the annotation type to the message reaction type and provide convenient `message.reactions.unique`, `message.reactions.distinct`, and `message.reactions.multiple` fields. When working with Pub/Sub integrations, you will need to either use the annotations directly or apply the mappping in your own code.
6764

68-
All messages on a chat channel (or any channel with the **Message annotations, updates, and deletes** rule enabled) contain a `message.annotations.summary` field if the summary isn't empty.
65+
All messages on a chat channel (or any channel with the **Message annotations, updates, and deletes** rule enabled) contain a `message.annotations.summary` field if the summary isn't empty. This is true even if the action is not `message.summary`.

0 commit comments

Comments
 (0)