Send Messages to Existing Clients

To send a message to an existing client, you must provide one of the following parameters: clientId, threadsClientId, or threadId.

Following are three types of answers in order of priority:

  1. By threadsClientId: This is an internal client ID, it is applicable for both authorized and unauthorized clients.
  2. By clientId: This is an external client ID. It is more often used for authorized clients; it is not tied to a specific thread.
  3. By threadId: This is the ID of the thread by which you want to identify the client and send them a message.

Permissions

  ----
  Permissions:INTEGRATOR,OPERATOR,SUPERVISOR
  ----

Request Parameters

ParameterTypeDescription
clientIdstring (optional)External client identifier
threadsClientIdlong (optional)Internal client identifier in edna Chat Center
threadIdlong (optional)Thread identifier required to determine the client to send a message to
textstringMessage text
attachmentslist <attachemntDTO>List of attachments for the message

Example of an Attachment Object

The image name must contain the file extension, or the file type (for example, image/jpg) must be specified for the file to be displayed correctly to the client.

ParameterTypeDescription
 urlstringFile URL. String up to 4,000 characters
 namestringFile name. String up to 1,000 characters
 typestringFile MIME type. String up to 256 characters
 sizeintegerFile size in bytes
"attachments": [
    {
        "url": "http://...",
        "name": "test.jpg",
        "type": "image/jpeg",
        "size": 256
    }
],
...

HTTP Request

  • Example for clientID:
POST /api/v1/messages/outgoing HTTP/1.1
Content-Type: application/json
Authorization: Bearer <integrator_token>
Content-Length: 78
Host: localhost: 8080
{
    "text": "message",
    "attachments": [],
    "clientId": "clientId"
}
  • Example for threadsClientId:
POST /api/v1/messages/outgoing HTTP/1.1
Content-Type: application/json
Authorization: Bearer <integrator_token>
Content-Length: 76
Host: localhost: 8080
{
    "text": "message",
    "attachments": [],
    "threadsClientId": 1
}
  • Example for threadId:
POST /api/v1/messages/outgoing HTTP/1.1
Content-Type: application/json
Authorization: Bearer <integrator_token>
Content-Length: 45
Host: localhost: 8080
{
    "text": "message",
    "threadId": 1
}

Response Parameters

ParameterTypeDescription
idlongUnique identifier of the message in edna Chat Center
threadIdlongUnique identifier of the new thread for the sent message in edna Chat Center
clientIdlongUnique identifier of the client to whom the message was sent
clientExternalIdstringUnique external identifier of the client to whom the message was sent
agentIdlongUnique identifier of the agent from whom the message was sent

Example of a Successful HTTP Response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 108
{
    "id": 1,
    "threadId": 2,
    "clientId": 1,
    "clientExternalId": "clientId",
    "agentId": 3
}