Description

A message is sent whenever a user (or a bot) wants to communicate with another user or a group.

Examples

{
    "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.

{
    "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

NameTypeRequiredDescription
fromStringYesId of the user who sent the message.
toStringYesId of the user or group to whom the message was sent.
id
StringNoClient id for the message
uidStringYesA unique server id for the message.
timestampNumberYesServer timestamp of the message. Number of milliseconds since epoch.
textStringYesMessage text added by the user.
flockmlStringNoFlockML content for the message.
notificationStringNo

Text to be shown as the message's notification. (Default is text.)

appIdStringNoId of the app that sent the message.
mentionsArrayNo

An array of user ids indicating users who have been mentioned in the message.

Only relevant for group messages.

sendAsObject (Elaborated below)NoThis field is used this if the sender would want to display another name and image as the sender.
attachmentsArray of AttachmentsNo

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:

NameTypeRequiredDescription
nameStringYesName of the sender.
profileImageStringYesURL of the sender's profile image.