Emit this socket event to send a chat message. The Avaya Spaces socket server will emit either SEND_MESSAGE_FAILED(if message was not sent) or MESSAGE_SENT (if message was sent successfully).

To create posts: /api/spaces/{spaceid}/ideas or tasks: /api/spaces/{spaceid}/tasks.

Payload Parameters

NameDescriptionJSON type
categoryType of message to send, can be: 'chat'string
content
  • bodyText: message text to send
  • data: array of objects representing attached files
    • fileId: (string) fileKey from /files/getuploadurl
    • fileSize: (int) size of file in bytes
    • fileType: (string) 'image', 'video', 'audio', or (default) 'document'
    • name: (string) file name
    • provider: (string) 'native'
    • providerFileType: (string) MIME type
    • thumbnailFile: (string, optional) fileKey of thumbnail file. See here.
  • description: (string) optional description.
Object
parentMsgObject containing the data of the parent post or task
  • _id: (string) unique identifier of the post/task
Object
createdTimestamp of when user initiated send.string
topicIdUnique identifier of topic to send message to. Note: Direct messages are sent to a topic with only 2 members. To retrieve the topicId for a direct message see /spaces/direct/{userType}/{userId}.string
loopbackMetadataOptional. This field will be passed back unchanged from server in MESSAGE_SENT. This property is only sent to the socket connection that created it.Any

Authorization

None.

Example

socketConnection.emit('SEND_MESSAGE', payload);

Payload Sent

{
  "category": "chat",
  "content": {
      "bodyText": "this is the message.",
      "data": [
        {
            "fileId": "9ec91803-9a64-4294-aaa0-a171bd57e300",
            "fileSize": 32553,
            "fileType": "image",
            "name": "sample-1.jpg",
            "provider": "native",
            "providerFileType": "image/jpeg",
            "thumbnailFile": "44e4e7ef-bae7-4605-b9df-485b880dd1b0"
        }
      ]
  },
  "created": "2017-06-26T18:09:55.839Z",
  "topicId": "594140a11d108619100a7360",
  "loopbackMetadata": "some metadata"
}

Payload (with parent post or task)

{
  "content":{
      "bodyText":"comment2",
      "data":[

      ]
  },
  "created":"2017-07-21T13:30:11.626Z",
  "category":"chat",
  "topicId":"596ceea522910357ccc67151",
  "parentMsg":{
      "_id":"5971ff7d608d7917f1238951"
  }
}