Greg_Walters1 | 2024-03-25 15:19:08 UTC | #1
How do I Generate a ConversationId and CommunicationId for POST /api/v2/conversations/messages/{conversationId}/communications/{communicationId}/messages
Greg_Boston | 2024-03-26 11:57:32 UTC | #2
Hi @Greg_Walters1 as you see there you need an active conversation/communication for that endpoint to work. It's designed to outbound a message from Genesys Cloud to the end user on that messaging platform (web messaging, open, whatsapp, etc). This endpoint would be used from a Genesys Cloud agent. There are a couple ways to start a conversation.
- The end customer inbounds a message on your Web messaging deployment, or messaging integration, etc. This is the most typical way those conversations are generated. You might find more helpful info here https://help.mypurecloud.com/articles/about-messaging/
- You can generate an outbound initiated conversation using https://apicentral.genesys.cloud/api-explorer-standalone?requestConfig=eyJvcGVyYXRpb25JZCI6InBvc3RDb252ZXJzYXRpb25zTWVzc2FnZXMifQ==#post-api-v2-conversations-messages this document explains how to do this via the UI https://help.mypurecloud.com/articles/send-an-outbound-message-on-behalf-of-a-queue/ but it uses that above linked api.
Greg_Walters1 | 2024-03-28 15:22:26 UTC | #3
Hi Greg, I was able to run the flow and capture the API calls. The only thing I cannot find is how to get the communicationsId in the
POST /api/v2/conversations/messages/<conversationId>/communications/<communitactionsId>/messages
The conversationId is generated by the POST /api/v2/conversations/messages which creates the conversation.
Is the communicationsId static by login user? Is there a GET to find the value?
Thanks, Greg
Greg_Boston | 2024-03-28 15:28:00 UTC | #4
CommunicationId is in the Conversation model (the one you POSTed), but it's named a little weirdly. So it does bring confusion, not just to you. We are working on documentation to help clarify, and it should explain your exact use case here. For now though, take a look at this page https://developer.genesys.cloud/commdigital/digital/messagemedia/ this is unrelated to what you are doing, but at the top it has a little example of what a communicationId is on a Conversation. So I think it will help you for your use case here.
Greg_Walters1 | 2024-03-28 15:36:48 UTC | #5
Got it. Looks like it is stored in the "peer" value is you use GET /conversations/messages
Thank you very much!!!
Greg_Walters1 | 2024-03-28 18:25:51 UTC | #6
Hi Greg, Now writing the calls in Python. Having an issue with the login. Doing the following, but I don't know what to put for the encodedsamlassertion. Also, do I have to set the region to uwsc2 somehow. I saw some code doing that, but am assuming you know based on the orgName
import PureCloudPlatformClientV2
clientid = "xxxxxx@xxx.com" clientsecret = "xxxxx"
apiclient = PureCloudPlatformClientV2.apiclient.ApiClient().getsaml2bearertoken(clientid, clientsecret, "orgName", encodedsamlassertion??????) usersApi = PureCloudPlatformClientV2.UsersApi(apiclient) print(usersApi.getusers_me())
Greg_Boston | 2024-03-28 18:39:42 UTC | #7
I'm not part of the Auth side, so can't provide much help there. Someone else might see this and be able to provide assistance. Or you could consider starting a new post about Auth login, as that would allow it to be more visible on the forum. I found this doc, but not sure it can help with your questions or not https://developer.genesys.cloud/authorization/platform-auth/use-saml2-bearer
system | 2024-04-28 18:39:50 UTC | #8
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: 25396