mnj | 2023-02-14 13:39:13 UTC | #1
I'm using the PureCloud API directly via the HTTP REST endpoints.
We have the following scenario:
- First, we need to create an email conversation, in order to get hold of the ID of the new conversation (conversationId).
- Next, we generate the actual mail content (HTML), which contains the conversationId within it.
- The last step is to update the previously created conversation with the HTML content that was generated in step 2.
I'm having trouble with step no. 3. Until now, we haven't needed the conversationId, so we've been creating the conversation with its content in one API call. We were using the endpoint: POST /api/v2/conversations/emails.
Now, to follow the updated scenario, I believe we should still use POST /api/v2/conversations/emails in step 1, and then in step 3, we should probably use the endpoint PUT /api/v2/conversations/emails/{conversationId}/messages/draft. I cannot manage to get it working though. Even though I'm getting a 200 status as a response, in the PureCloud UI (https://apps.mypurecloud.de/directory/#/activity), the conversation is just empty. Previously, when I would create it with POST with content at once, PureCloud UI would show the content of the email.
To give you an example of what I'm doing, here are the payloads I'm sending:
In step 1:
POST /conversations/emails
{
"queueId": "{MY QUEUE ID}",
"direction": "OUTBOUND",
"toAddress": "some.customer@gmail.com",
"subject": "Some topic"
}
The new conversation appears in the PureCloud UI, with empty content:
In step 3: (I use conversationId that I received from the POST above)
PUT /api/v2/conversations/emails/{conversationId}/messages/draft
{
"htmlBody": "<p style=\"margin: 0px; padding: 0px;\"><strong>This is a test!!!<br /></strong></p>"
}
I also tried adding more data to the body:
{
"subject": "Propozycja podróży eSky",
"to": [
{
"email": "some.customer@gmail.com"
}
],
"from": {
"email": "test@test.com",
"name": "Test 2"
},
"cc": [],
"bcc": [],
"htmlBody": "<p style=\"margin: 0px; padding: 0px;\"><strong>This is a test!!!<br /></strong></p>",
"emailSizeBytes": 135,
"maxEmailSizeBytes": 41943040,
"attachments": [],
"historyIncluded": false
}
That doesn't change anything - I get 200, but PureCloud UI shows empty content in my conversation.
Previously, I'd do it in one call, like this:
POST /conversations/emails
{
"queueId": "5363e1a3-fa9a-4e90-9b5e-538d14c02a24",
"direction": "OUTBOUND",
"toAddress": "[marcin.jahn@esky.com](mailto:marcin.jahn@esky.com)",
"subject": "Some topic",
"htmlBody": "<p style=\"margin: 0px; padding: 0px;\"><strong>This is a test!!!<br /></strong></p>"
}
and it just worked - the conversation in PureCloud UI has the content "This is a test!!!".
What am I doing wrong in the new approach? Or maybe I need to use a different endpoint(s)? I'm doing all my testing through the API Explorer.
tim.smith | 2023-02-21 20:56:27 UTC | #2
mnj, post:1, topic:18412
That doesn't change anything - I get 200, but PureCloud UI shows empty content in my conversation.
Please open a case with Genesys Cloud Care to investigate this errant behavior. It definitely doesn't seem right that a 200 response isn't actually successful.
system | 2023-03-24 20:56:55 UTC | #3
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 18412