Send a chat message to a user or a chat room on behalf of an Output Messenger user. The message is delivered as a regular chat message from the sender, so it shows in the normal conversation, is saved in the chat history and reaches the recipient’s mobile devices like any other message. Use it when an external system (a helpdesk, monitoring tool, CRM, script and so on) needs to talk in a user’s chat.
To post an alert-style notification card instead, use the Send Notification API.
POST /api/chat?from=sam&to=John&message=Your ticket 4521 has been resolved
Send to a chat room:
POST /api/chat?from=sam&room=Support&message=New ticket 4522 posted
Add the API key in the API-KEY request header, as described in Authentication. The default port is 14125, for example http://myserver:14125/api/chat.
| Fields | Details |
|---|---|
| from Required | Sender’s username, email or user ID. The message is sent as this user. |
| to Optional | Receiver’s username, email or user ID. Optional when room is given. |
| room Optional | Chat room name. Optional when to is given. If both room and to are given, the message is sent to the room only. |
| messsge Required | Message text. |
Usernames and room names are not case-sensitive. In the query string, URL-encode the message (for example a space as %20, # as %23).
The parameters can also be sent in the request body as JSON or as form data:
POST /api/chat
API-KEY: PP3S67BYL8Y260D44887M3W655U7137X
Content-Type: application/json
{ "from": "sam", "to": "John", "message": "Your ticket 4521 has been resolved" }API Key Permission
The API key needs the Send Chat permission. In Server Manager > API, edit the key and tick Send Chat in the Notification section. Send Chat is separate from Send Notification, so you can allow a key to post notifications without letting it send chat messages as users.
![]()
Messages sent through the API show a small lightning icon (tooltip “Sent via API”) so users can tell them apart from messages typed in the app.
- The message also shows in the sender’s own conversation with the receiver (or in the room).
- It is saved in the chat history and in the central chat log.
- Recipients can reply to, forward and star it like any other message.
- Older client versions show the message without the icon.
{"success":true}If the request cannot be delivered, success is false and message gives the reason:
| Case | Response |
|---|---|
| Neither to nor room given | [{"success":false,"message":"[room] / [to] are required!"}] |
| Sender or receiver not found | [{"success":false,"message":"John user does not exists!"}] |
| Chat room not found | [{"success":false,"message":"Support room does not exists!"}] |
| Missing or invalid API key, or no Send Chat permission | HTTP 401 Unauthorized |
curl, query string:
curl -X POST "http://myserver:14125/api/chat?from=sam&to=John&message=Your%20ticket%204521%20has%20been%20resolved" \
-H "API-KEY: PP3S67BYL8Y260D44887M3W655U7137X"curl, JSON body:
curl -X POST "http://myserver:14125/api/chat" \
-H "API-KEY: PP3S67BYL8Y260D44887M3W655U7137X" \
-H "Content-Type: application/json" \
-d "{\"from\":\"sam\",\"room\":\"Support\",\"message\":\"New ticket 4522 posted\"}"Send Chat or Send Notification?
Send Chat (/api/chat) | Send Notification (/api/notify) | |
|---|---|---|
| Looks like | A normal chat message from the sender, with the API icon | A coloured notification card |
| Sender | Must be an existing user | Any name |
| Options | None | color, otr, notify |
| Recipients | One user, or one chat room | A user, a chat room, or both |
| Permission | Send Chat | Send Notification |