Description
A message is sent whenever a user (or a bot) wants to communicate with another user or a group.
Examples
A Plain Text Message
{ "from": "u:8c67055b-202f-4ffe-a18f-1c4553a50175", "to": "u:1e6429de-16b7-48b3-acc0-c2d7ec5ad195", "id": "bfbf7700", "uid": "1454595241007-6QpQpe-mh104", "text": "A plain text message", "timestamp": 1481808450532 }
Besides text, messages can also send rich content as an Attachment.
A Message with an Attachment
{ "from": "u:8c67055b-202f-4ffe-a18f-1c4553a50175", "to": "u:1e6429de-16b7-48b3-acc0-c2d7ec5ad195", "id": "bfbf7700", "uid": "1454595241007-6QpQpe-mh104" "text": "A rich text message", "timestamp": 1481808450532 "attachments": [{ "title": "A title", "description": "A little longer description", "views": { "widget": { "src": "<widget url>", "width": 400, "height": 400 }, "flockml": "<flockml>some content</flockml>" } }] }
Object Attributes
Name | Type | Required | Description |
---|---|---|---|
from | String | Yes | Id of the user who sent the message. |
to | String | Yes | Id of the user or group to whom the message was sent. |
id | String | No | Client id for the message |
uid | String | Yes | A unique server id for the message. |
timestamp | Number | Yes | Server timestamp of the message. Number of milliseconds since epoch. |
text | String | Yes | Message text added by the user. |
flockml | String | No | FlockML content for the message. |
notification | String | No | Text to be shown as the message's notification. (Default is text.) |
appId | String | No | Id of the app that sent the message. |
mentions | Array | No | An array of user ids indicating users who have been mentioned in the message. Only relevant for group messages. |
sendAs | Object (Elaborated below) | No | This field is used this if the sender would want to display another name and image as the sender. |
attachments | Array of Attachments | No | Any rich content to be included with the message is sent as part of attachments. Note: Currently, there is a limitation of one attachment per message. |
SendAs
The attributes of the sendAs
field are as follows:
Name | Type | Required | Description |
---|---|---|---|
name | String | Yes | Name of the sender. |
profileImage | String | Yes | URL of the sender's profile image. |