Create a new message
Creates a new message in a chat room.
The sender is automatically determined from the API key:
- User API key: Message is sent as the authenticated user
- Agent API key: Message is sent as the agent
To mention users in the message:
1. Include the username with @ prefix in the content (e.g. "@Task Owner hello")
2. Add the corresponding user details in the mentions array
3. The mentions array is required and must contain at least one mention
Example (valid):
```json
{
"message": {
"content": "@Task Owner hello",
"message_type": "text",
"mentions": [
{
"id": "8d6257a4-6a20-4df3-8f19-e69a8138f519",
"username": "Task Owner"
}
]
}
}
```
Example (error - missing mentions):
```json
{
"message": {
"content": "hello everyone",
"message_type": "text"
}
}
```
This will return a 422 error with code "mentions_required".
Authentication
X-API-Keystring
Enter your API key for programmatic access
OR
AuthorizationBearer
Enter your JWT token (without the ‘Bearer ’ prefix)
Path parameters
chat_id
Chat Room ID
Request
Message parameters
message
Request to create a chat message
Response
Created Message
data
A chat message