Send a message
post
/engagement/api/agent/{fqSiteName}/v1/postMessage
This operation is used by the agent to send messages to the end user. The collection of these messages comprises a chat engagement.
The following is the list of exception codes that can be returned by this operation:
The following is the list of exception codes that can be returned by this operation:
- ACCESS_DENIED - Authentication failure.
- UNKNOWN_EXCEPTION - An unknown error has occurred.
- CONFLICT - The lead participant has left the engagement.
- UNDEFINED_CONDITION - The core server produced a null result.
- INVALID_FIELD - A field in the request is invalid.
Request
Supported Media Types
- application/json; charset=utf-8
Path Parameters
-
fqSiteName(required): string
The fully qualified site name.
Header Parameters
-
X-AID(required): string
A header element containing the agent account identifier.
-
X-JSESSIONID(required): string
A header element containing the unique session identifier returned in the create automated agent session call.
The object containing the request information.
Root Schema : com.rightnow.chat.rest.agent_api.model.requests.v1.PostMessageRequest
Type:
Show Source
object-
body(required):
string
The message text.
-
destinationId(required):
integer(int64)
The unique identifier of the destination.
-
destinationType(required):
string
Allowed Values:
[ "NONE", "AGENT", "END_USER", "ENGAGEMENT", "GROUP", "PROFILE", "QUEUE", "SUBSCRIPTION_AGENT_STATS", "SUBSCRIPTION_AGENT_STATS_BY_GROUP", "SUBSCRIPTION_AGENT_STATS_BY_QUEUE", "SUBSCRIPTION_AGENT_GROUP_STATS", "SUBSCRIPTION_ENGAGEMENT_STATS", "SUBSCRIPTION_ENGAGEMENT_STATS_BY_QUEUE", "SUBSCRIPTION_ENGAGEMENT_STATS_BY_AGENT", "SUBSCRIPTION_QUEUE_STATS", "SYSTEM", "UNIVERSAL_QUEUE", "UNKNOWN" ]The destination type. -
messageDataMap:
object messageDataMap
An optional map of key/value String pairs associated with this message.
-
messageId:
string
The unique identifier of the message.
-
messageType(required):
string
Allowed Values:
[ "TEXT" ]The message type. In a future revision of this API operation, this field will not be required. -
richText:
boolean
Indicates whether the text message is rich text. If true, then the message is rich text.
-
sequenceNumber:
integer(int64)
The client application defined transaction sequence number.
-
timeCreated:
integer(int64)
The time the request was created in milliseconds.
-
visibility:
string
Allowed Values:
[ "NONE", "ALL", "NOT_ENDUSER" ]The visibility of the request.
Nested Schema : messageDataMap
Type:
objectAn optional map of key/value String pairs associated with this message.
Response
Supported Media Types
- application/json; charset=utf-8
200 Response
The request completed successfully.
Root Schema : com.rightnow.chat.rest.agent_api.model.responses.v1.PostMessageResponse
Type:
Show Source
object-
chatPostResult:
object com.rightnow.chat.rest.agent_api.model.responses.v1.results.ChatPostResult
-
chatSystemError:
object com.rightnow.chat.rest.agent_api.model.types.v1.ChatSystemError
-
clientId:
integer(int64)
The unique identifier of the agent client, created to identify the agent during this agent session.
-
clientIdString:
string
The unique identifier of the agent client in string format, created to identify the agent during this agent session.
-
clientSendTime:
integer(int64)
The time when the client request was received in yyyy-MM-dd'T'HH:mm:ssXXX format.
-
sequenceNumber:
integer(int64)
The client application defined transaction sequence number.
-
sequenceNumberString:
string
The client application defined transaction sequence number as a string.
-
serviceFinishTime:
integer(int64)
The time when the chat server completed processing the client request in yyyy-MM-dd'T'HH:mm:ssXXX format.
-
serviceStartTime:
integer(int64)
The time when the chat server began processing the client request in yyyy-MM-dd'T'HH:mm:ssXXX format.
-
sessionId:
string
The unique identifier of the agent session.
Nested Schema : com.rightnow.chat.rest.agent_api.model.responses.v1.results.ChatPostResult
Type:
Show Source
object-
clientReset(required):
integer(int32)
The client reset indicator.
Nested Schema : com.rightnow.chat.rest.agent_api.model.types.v1.ChatSystemError
Type:
Show Source
object-
errorCondition:
string
The error condition.
-
text:
string
The error text.
-
type:
string
The error type.
400 Response
The validation of the request object failed.
Root Schema : schema
Type:
object403 Response
The agent session identifier is unknown.
Root Schema : schema
Type:
object404 Response
The resource was not found.
Root Schema : schema
Type:
object500 Response
An error occurred in the chat server while processing the request.
Root Schema : schema
Type:
objectExamples
The following example shows how to post a message to the end user.
cURL Command Example
curl -X POST https://chat_rest_server_domain.com/engagement/api/agent/day001_221100_sql_001h/v1/postMessage?pool=297:1 -H 'Content-Type: application/json; charset=UTF-8' -H 'X-JSESSIONID: node01h8m13tljpm7ns8nayp0pid91' -d ' -H 'X-AID: 12' {"timeCreated" :1618317020415, "sequenceNumber" : 5, "visibility" : "ALL", "body" : "Sample message text.", "destinationId" : 27, "destinationType" : "ENGAGEMENT", "messageType" : "TEXT", "messageId" : "1", "richText" : null, "messageDataMap" : null}'
Request Body Example
The following shows an example of the request body in JSON format.
{
"timeCreated" : 1621869388454,
"sequenceNumber" : 5,
"visibility" : "ALL",
"body" : "Sample message text.",
"destinationId" : 27,
"destinationType" : "ENGAGEMENT",
"messageType" : "TEXT",
"messageId" : "1",
"richText" : null,
"messageDataMap" : null
}
Response Header Example
The following shows an example of the response header.
Status: 200 OK Content-Type: application/json;charset=utf-8
Response Body Example
The following shows an example of the response body in JSON format.
{
"chatPostResult": {
"clientReset": "0"
},
"chatSystemError": null,
"clientSendTime": 1564598688444,
"serviceStartTime": 1653492901569,
"serviceFinishTime": 1653492901701,
"sessionId": "node01hyuckn70y6nm1g2hco4hrwlqq0",
"clientId": 47,
"clientIdString": "47",
"sequenceNumber": 5,
"sequenceNumberString": "5"
}