Send Chat Message


This request posts a message to a chat session.

Resource

POST /chats/<OID>/messages

Where OID is the object ID of the chat session.

Parameters

None

Payload

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

An attachment can also be set before in the Chat Concept. If this is done you can send the attachment by adding an attachment object to the chat concepts with the object ID that equals to the Chat Concept attachment object ID.
Check out the send attachment concept 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

10104

Cannot send attachments in external chat sessions.

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

Send a plain text

Payload
{
  "text": "we need a bigger boat",
  "clientId": "tablet support"
}
Response
{
    "object": {
        "subject": "we need a bigger boat",
        "date": "2024-10-11 15:13:15",
        "contents": {
            "content": "we need a bigger boat",
            "contentType": "",
            "oid": "4647564",
            "objectType": "Comment"
        },
        "durationSec": 0,
        "incoming": false,
        "retrieved": true,
        "displayed": true,
        "displayedUser": "",
        "flagged": false,
        "forwarded": false,
        "processed": false,
        "recordingStatus": "unknown",
        "hasAttachment": false,
        "hasInlineAttachment": false,
        "hasMessageReference": false,
        "contentSummary": "we need a bigger boat",
        "contentSummaryIsComplete": true,
        "participants": [
            {
                "commonName": "Arno",
                "role": "rtFrom",
                "address": "",
                "addressable": {
                    "commonName": "Arno",
                    "oid": "1389401",
                    "objectType": "Person"
                },
                "addresseeLabel": "Arno",
                "person": {
                    "commonName": "Arno",
                    "oid": "1389401",
                    "objectType": "Person"
                },
                "oid": "4647565",
                "objectType": "Addressee"
            },
            {
                "commonName": "Haas",
                "role": "rtTo",
                "address": "",
                "addressable": {
                    "iconId": "4435216",
                    "commonName": "Haas",
                    "oid": "1815710",
                    "objectType": "Person"
                },
                "addresseeLabel": "Haas",
                "person": {
                    "commonName": "Haas",
                    "oid": "1815710",
                    "objectType": "Person"
                },
                "oid": "4647566",
                "objectType": "Addressee"
            }
        ],
        "voicemail": false,
        "voicemailIsHeard": false,
        "callId": "",
        "id": "afa28202d7f6642a",
        "callFlowId": "",
        "phone": "",
        "isConferenceCall": false,
        "callAnswerTimeSec": 0,
        "onHoldDuration": 0,
        "trunk": "",
        "phoneLine": {
            "permissions": "ReadWriteRemove",
            "commonName": "Arno",
            "oid": "1389593",
            "objectType": "XCCPhoneLine"
        },
        "wrapUpTime": 0,
        "chatSessionType": "user",
        "whatsAppTemplateCategory": "",
        "transferredFromName": "",
        "transferredToName": "",
        "chatSession": {
            "permissions": "ReadWriteRemove",
            "commonName": "Chat Haas <-> Arno",
            "oid": "1935036",
            "objectType": "XCCChatSession"
        },
        "afterCallType": "",
        "packetsLog": [],
        "permissions": "ReadWriteRemove",
        "commonName": "Arno -> Haas, 2024-10-11",
        "oid": "4647563",
        "objectType": "XCCUserChat"
    }
}

Send an attachment with base64

Payload
{
    "clientId": "tablet support",
    "attachment": {
      "originalLocation": "circle.jpg",
      "commonName": "circle.jpg",
      "mimeType": "image/jpg",
      "contentsB64String":  "/9j/4AAQSkZJRgABAgAAAQA"
    }
}
Response
{
    "object": {
        "subject": "",
        "date": "2024-10-11 15:14:27",
        "contents": {
            "content": "",
            "contentType": "",
            "oid": "4647579",
            "objectType": "Comment"
        },
        "durationSec": 0,
        "incoming": false,
        "retrieved": true,
        "displayed": true,
        "displayedUser": "",
        "flagged": false,
        "forwarded": false,
        "processed": false,
        "recordingStatus": "unknown",
        "hasAttachment": true,
        "hasInlineAttachment": false,
        "hasMessageReference": false,
        "contentSummary": "",
        "contentSummaryIsComplete": true,
        "participants": [
            {
                "commonName": "Arno",
                "role": "rtFrom",
                "address": "",
                "addressable": {
                    "commonName": "Arno",
                    "oid": "1389401",
                    "objectType": "Person"
                },
                "addresseeLabel": "Arno",
                "person": {
                    "commonName": "Arno",
                    "oid": "1389401",
                    "objectType": "Person"
                },
                "oid": "4647580",
                "objectType": "Addressee"
            },
            {
                "commonName": "Haas",
                "role": "rtTo",
                "address": "",
                "addressable": {
                    "iconId": "4435216",
                    "commonName": "Haas",
                    "oid": "1815710",
                    "objectType": "Person"
                },
                "addresseeLabel": "Haas",
                "person": {
                    "commonName": "Haas",
                    "oid": "1815710",
                    "objectType": "Person"
                },
                "oid": "4647581",
                "objectType": "Addressee"
            }
        ],
        "attachments": [
            {
                "originalLocation": "attachment",
                "mimeType": "",
                "hasThumbnail": false,
                "size": 0,
                "commonName": "",
                "oid": "4647575",
                "objectType": "Attachment"
            }
        ],
        "voicemail": false,
        "voicemailIsHeard": false,
        "callId": "",
        "id": "73830f926be8ed81",
        "callFlowId": "",
        "phone": "",
        "isConferenceCall": false,
        "callAnswerTimeSec": 0,
        "onHoldDuration": 0,
        "trunk": "",
        "phoneLine": {
            "permissions": "ReadWriteRemove",
            "commonName": "Arno",
            "oid": "1389593",
            "objectType": "XCCPhoneLine"
        },
        "wrapUpTime": 0,
        "chatSessionType": "user",
        "whatsAppTemplateCategory": "",
        "transferredFromName": "",
        "transferredToName": "",
        "chatSession": {
            "permissions": "ReadWriteRemove",
            "commonName": "Chat Haas <-> Arno",
            "oid": "1935036",
            "objectType": "XCCChatSession"
        },
        "afterCallType": "",
        "packetsLog": [],
        "permissions": "ReadWriteRemove",
        "commonName": "Arno -> Haas, 2024-10-11",
        "oid": "4647577",
        "objectType": "XCCUserChat"
    }
}

Send an attachment with concept attachment

Payload
{
    "clientId": "tablet support",
    "attachment": {
      "oid": "1804087"
    }
}
Response
{
    "object": {
        "subject": "",
        "date": "2024-10-11 15:14:27",
        "contents": {
            "content": "",
            "contentType": "",
            "oid": "4647579",
            "objectType": "Comment"
        },
        "durationSec": 0,
        "incoming": false,
        "retrieved": true,
        "displayed": true,
        "displayedUser": "",
        "flagged": false,
        "forwarded": false,
        "processed": false,
        "recordingStatus": "unknown",
        "hasAttachment": true,
        "hasInlineAttachment": false,
        "hasMessageReference": false,
        "contentSummary": "",
        "contentSummaryIsComplete": true,
        "participants": [
            {
                "commonName": "Arno",
                "role": "rtFrom",
                "address": "",
                "addressable": {
                    "commonName": "Arno",
                    "oid": "1389401",
                    "objectType": "Person"
                },
                "addresseeLabel": "Arno",
                "person": {
                    "commonName": "Arno",
                    "oid": "1389401",
                    "objectType": "Person"
                },
                "oid": "4647580",
                "objectType": "Addressee"
            },
            {
                "commonName": "Haas",
                "role": "rtTo",
                "address": "",
                "addressable": {
                    "iconId": "4435216",
                    "commonName": "Haas",
                    "oid": "1815710",
                    "objectType": "Person"
                },
                "addresseeLabel": "Haas",
                "person": {
                    "commonName": "Haas",
                    "oid": "1815710",
                    "objectType": "Person"
                },
                "oid": "4647581",
                "objectType": "Addressee"
            }
        ],
        "attachments": [
            {
                "originalLocation": "attachment",
                "mimeType": "",
                "hasThumbnail": false,
                "size": 0,
                "commonName": "",
                "oid": "4647575",
                "objectType": "Attachment"
            }
        ],
        "voicemail": false,
        "voicemailIsHeard": false,
        "callId": "",
        "id": "73830f926be8ed81",
        "callFlowId": "",
        "phone": "",
        "isConferenceCall": false,
        "callAnswerTimeSec": 0,
        "onHoldDuration": 0,
        "trunk": "",
        "phoneLine": {
            "permissions": "ReadWriteRemove",
            "commonName": "Arno",
            "oid": "1389593",
            "objectType": "XCCPhoneLine"
        },
        "wrapUpTime": 0,
        "chatSessionType": "user",
        "whatsAppTemplateCategory": "",
        "transferredFromName": "",
        "transferredToName": "",
        "chatSession": {
            "permissions": "ReadWriteRemove",
            "commonName": "Chat Haas <-> Arno",
            "oid": "1935036",
            "objectType": "XCCChatSession"
        },
        "afterCallType": "",
        "packetsLog": [],
        "permissions": "ReadWriteRemove",
        "commonName": "Arno -> Haas, 2024-10-11",
        "oid": "4647577",
        "objectType": "XCCUserChat"
    }
}