I cannot send any message in a chat interaction that has already started.
First, I created a chat interaction:
POST /api/v2/conversations/chats
Body:
{
"queueId": "232f682a-c300-4656-86eb-e842bbc1636c",
"provider": "Chat System",
"customerName": "User 1"
}
Response:
{
"id": "3dc8557e-6245-4bd3-9a8c-a2c7344c9e24",
"otherMediaUris": [],
"selfUri": "/api/v2/conversations/chats/3dc8557e-6245-4bd3-9a8c-a2c7344c9e24"
}
With that, the interaction arrives correctly at the frontend, and the Agent can handle the interaction.
Following the instructions in this post, I made a new request to obtain CommunicationID:
GET /api/v2/analytics/conversations/3dc8557e-6245-4bd3-9a8c-a2c7344c9e24/details
Response
{
"conversationId": "3dc8557e-6245-4bd3-9a8c-a2c7344c9e24",
"conversationStart": "2021-03-22T05:03:31.512Z",
"originatingDirection": "inbound",
"divisionIds": [
"2ce2cb60-c191-4301-aebd-b874352bdd18"
],
"participants": [
{
"participantId": "e42cc774-4008-4eb2-9e0a-a2b4bb45223e",
"participantName": "User 1",
"purpose": "external",
"sessions": [
{
"mediaType": "chat",
"sessionId": "213c8bdf-d2e3-4c0e-a1ae-e372cb31cb9e",
"direction": "inbound",
"roomId": "NONE",
"segments": [
{
"segmentStart": "2021-03-22T05:03:31.512Z",
"segmentType": "interact",
"conference": false
}
],
"metrics": [
{
"name": "nConnected",
"value": 1,
"emitDate": "2021-03-22T05:03:31.512Z"
}
],
"provider": "Chat System"
}
]
},
{
"participantId": "7c986ef3-4ec7-45cc-b86d-45eba847927b",
"participantName": "SMS_Test",
"purpose": "acd",
"sessions": [
{
"mediaType": "chat",
"sessionId": "3fbc7b0a-bafd-417b-99dd-8330fe67dfe3",
"direction": "inbound",
"roomId": "NONE",
"peerId": "213c8bdf-d2e3-4c0e-a1ae-e372cb31cb9e",
"segments": [
{
"segmentStart": "2021-03-22T05:03:31.513Z",
"segmentEnd": "2021-03-22T05:09:55.331Z",
"queueId": "232f682a-c300-4656-86eb-e842bbc1636c",
"disconnectType": "transfer",
"segmentType": "interact",
"conference": false
}
],
"metrics": [
{
"name": "nOffered",
"value": 1,
"emitDate": "2021-03-22T05:03:31.513Z"
},
{
"name": "tAcd",
"value": 383818,
"emitDate": "2021-03-22T05:09:55.331Z"
}
],
"provider": "Chat System",
"remote": "User 1",
"requestedRoutings": [
"Standard"
],
"usedRouting": "Standard",
"selectedAgentId": "650e52ea-35d0-45d3-8047-4263cef91ab3"
}
]
},
{
"participantId": "e49a1dd7-c98f-4117-a84a-972b0501cffa",
"userId": "650e52ea-35d0-45d3-8047-4263cef91ab3",
"purpose": "agent",
"sessions": [
{
"mediaType": "chat",
"sessionId": "053889e8-427d-43a3-ade4-1b0f371f90c6",
"direction": "inbound",
"roomId": "NONE",
"peerId": "213c8bdf-d2e3-4c0e-a1ae-e372cb31cb9e",
"segments": [
{
"segmentStart": "2021-03-22T05:08:00.281Z",
"segmentEnd": "2021-03-22T05:08:30.399Z",
"queueId": "232f682a-c300-4656-86eb-e842bbc1636c",
"disconnectType": "system",
"segmentType": "alert",
"conference": false
}
],
"metrics": [
{
"name": "tAlert",
"value": 30118,
"emitDate": "2021-03-22T05:08:30.399Z"
},
{
"name": "tNotResponding",
"value": 30118,
"emitDate": "2021-03-22T05:08:30.399Z"
}
],
"provider": "Chat System",
"remote": "User 1",
"requestedRoutings": [
"Standard"
],
"selectedAgentId": "650e52ea-35d0-45d3-8047-4263cef91ab3"
}
]
},
{
"participantId": "746eb0e1-2247-400f-bd11-4042a9d6322b",
"userId": "650e52ea-35d0-45d3-8047-4263cef91ab3",
"purpose": "agent",
"sessions": [
{
"mediaType": "chat",
"sessionId": "f80dddaf-30b0-465c-a33d-6b014fbbcf8e",
"direction": "inbound",
"roomId": "NONE",
"peerId": "213c8bdf-d2e3-4c0e-a1ae-e372cb31cb9e",
"segments": [
{
"segmentStart": "2021-03-22T05:09:52.203Z",
"segmentEnd": "2021-03-22T05:09:55.327Z",
"queueId": "232f682a-c300-4656-86eb-e842bbc1636c",
"segmentType": "alert",
"conference": false
},
{
"segmentStart": "2021-03-22T05:09:55.327Z",
"queueId": "232f682a-c300-4656-86eb-e842bbc1636c",
"segmentType": "interact",
"conference": false
}
],
"metrics": [
{
"name": "nOverSla",
"value": 1,
"emitDate": "2021-03-22T05:09:55.327Z"
},
{
"name": "tAlert",
"value": 3124,
"emitDate": "2021-03-22T05:09:55.327Z"
},
{
"name": "tAnswered",
"value": 383818,
"emitDate": "2021-03-22T05:09:55.327Z"
}
],
"provider": "Chat System",
"remote": "User 1",
"requestedRoutings": [
"Standard"
],
"usedRouting": "Standard",
"selectedAgentId": "650e52ea-35d0-45d3-8047-4263cef91ab3"
}
]
}
]
}
From what I understand from the post, the sessionID of the first participant is the communicationID
So I try to send the first message programmatically
POST /api/v2/conversations/chats/3dc8557e-6245-4bd3-9a8c-a2c7344c9e24/communications/213c8bdf-d2e3-4c0e-a1ae-e372cb31cb9e/messages
Body
{
"body": "Hello World"
}
Response
{
"message": "Not Found",
"code": "chat.error.not.found",
"status": 404,
"messageWithParams": "Not Found",
"messageParams": {},
"contextId": "35699c57-5927-44ef-aad2-1d584f1ec7bd",
"details": [],
"errors": []
}
Why can't I find the chat?
I performed all of these tests using API Explorer. The behavior of the frontend is as expected (Where the agent does not send and receive messages through Genesys Cloud, and can only perform administrative tasks such as associating profiles and choosing the wrapup code). All messages that will be sent through this development will be done via API.
Thanks in advance!