Send External Chat Message


This request posts a message to an external chat session.

Resource

POST /chats/<OID>/messages/external

Where OID is the object ID of the chat session.

Parameters

None

Payload

An attachment has to be send with a base64 encoded string. Check out the send attachment example for more information.

Response

The Chat Message object contains the chat contents and the object ID.

Context

Authorization

User

Errors

HTTP code Xelion code Description

400

10203

No chat contents were specified.

10203

Failed to decode the Chat Contents object.

10203

An empty chat message is sent.

404

10066

The chat session is disabled, chats cannot be sended.

Example

Request
POST https://xelion.nl/api/v1/master/chats/1588675/messages/external

Send a plain text

Payload
{
  "text": "we need a bigger boat",
  "clientId": "tablet support"
}
Response
{
    "object": {
        "contents": "we need a bigger boat",
        "date": "2018-04-06 17:58:49",
        "incoming": false,
        "read": false,
        "clientId": "tablet support",
        "communication": {
            "oid": "1932333",
            "objectType": "XCCUserChat"
        },
        "oid": "1739638",
        "objectType": "XCCChat"
    },
    "links": [
        {
            "rel": "self",
            "method": "GET"
        }
    ]
}

Send an attachment

Payload
{
    "clientId": "tablet support",
    "attachment": {
      "originalLocation": "circle.jpg",
      "commonName": "circle.jpg",
      "mimeType": "image/jpg",
      "contentsB64String":  "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAQABADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD2fVdUmtLmCxsLZLrUrlHkiillMUYjQqHd3CsQAXQABWJLjjG5lNK1Sa7ubixv7ZLXUrZEkliilMsZjcsEdHKqSCUcEFVIKHjG1mNV0ua7uYL6wuUtdStkeOKWWIyxmNypdHQMpIJRCCGUgoOcblY0rS5rS5uL6/uUutSuUSOWWKIxRiNCxREQsxABdySWYkuecbVUA//Z"
    }
}
Response
{
    "object": {
        "reference": {
            "commonName": "",
            "oid": "1804087",
            "objectType": "Attachment"
        },
        "date": "2018-07-11 10:38:46",
        "incoming": false,
        "read": false,
        "clientId": "tablet support",
        "communication": {
            "oid": "1932333",
            "objectType": "XCCUserChat"
        },
        "oid": "1804088",
        "objectType": "XCCChat"
    },
    "links": [
        {
            "rel": "self",
            "method": "GET"
        }
    ]
}