Rich Text Body
Rich Text Body Format Documentation
For certain API endpoints like creating a chat room message API, we expect a message body in rich_text_body
.
This document explains how to structure rich text content in the API, including text, links, mentions, and attachments.
Basic Structure
The rich text body follows a nested JSON structure with a root object containing a body
field:
Content Types
1. Plain Text
To include plain text, use a paragraph node with text content:
2. Links
To add a link, include the link attributes in the marks
array:
3. Mentions
To mention a user, use the mention type with their SGID:
4. Line Breaks
To add a line break, use the hardBreak type:
5. Attachments
To include attachments, add an attachments
array at the root level with signed IDs:
Complete Example
Here's a complete example that combines multiple elements:
Important Notes
All content must be wrapped in a paragraph node
Links require both
href
andtarget
attributesMentions require a valid SGID
Attachments must be uploaded separately first to obtain signed IDs
Line breaks can be added between any content nodes using
hardBreak
type
Tips for Implementation
Always validate the JSON structure before sending
Ensure all SGIDs for mentions are valid and current
Verify that attachment signed IDs are obtained from the direct upload endpoint
Test the content rendering with various combinations of elements
Handle line breaks appropriately for proper message formatting
Last updated