CRM Integration - Sync WrapUp Codes between PC and CRM

Hello there good folks of PC Developer Forum,

Currently, there is an integration with a Cloud-Based CRM called PipeDrive. We are already in conversation with the client regarding how to sync the ACW (wrapup). Whether it should be PipeDrive that should be updating the disposition to Genesys or Vice Versa. So the question here is basically as follows:

Can PipeDrive call an API towards PureCloud to update the disposition? - I believe the answer is yes and this is the API that needs to be called: https://developer.mypurecloud.com/api/rest/v2/conversations/#patch-api-v2-conversations--conversationId--participants--participantId- Now the next question here would be how to get the conversation ID and the participant ID. In scripter built-in variables, which variables would be the ones equivalent to the two parameters required here? Is it going to be such that we have to use a third-party web service to fetch all these details and then use the same web-service to call the APIs to disconnect and Wrap-Up the call? Otherwise, what would be the alternative approach for the same? Also, if the aforementioned is possible, will the current interaction automatically get disconnected as soon as relevant API(s) get called?

Please do shed some light on this.

Thanks in advance.

I'll start with the sticking point first. You are correct about the API used to set the wrap up code on the conversation. That API resource requires a user context, which means the agent must log in to your app using the Implict or Auth Code grants, and the auth tokens will be valid for no longer than 48 hours, so the agents will need to re-authorize periodically. See details about Authorization. This means you can't have a fully headless server-to-server integration for this use case.

I would recommend using the Web Page script component to load a custom web page that you write to handle this integration. This web page can initiate the appropriate OAuth login process and make the necessary API requests, both to your CRM and PureCloud, to set the wrap up code. While it is a web page, there's no requirement that you require human intervention for your integration; it can simply load a script that does what it needs to do. In this context, the script component is simply a vehicle to load the custom web page. You can certainly integrate the functionality within the web page into anything else if that would be more convenient for you.

To determine the active conversation for the user, use GET /api/v2/conversations. Identify the desired conversation if they have multiple and identify the agent's participant to get the correct participant ID. Then you can use PATCH /api/v2/conversations/{conversationId}/participants/{participantId} to set the wrap up.

will the current interaction automatically get disconnected as soon as relevant API(s) get called

If all you're doing is setting the wrap up code, it will not affect the participant's state.

1 Like

Thanks a ton Tim. This most definitely has pointed me to the right direction. TBH we have also thought of the same approach using the Web Page to invoke scripts to achieve what we're willing to achieve however we were just not sure as to how flexible would that be but post your suggestion we would be researching and giving this a go.

If you don't mind me however asking a methodology for the other approach as well wherein the CRM gets updated after a call has taken place inside of PureCloud. Sadly, I was not able to find a webhook of sorts to trigger an API call from within PureCloud. The webhooks that are available I believe are not going to work in our use case. According to what I've been able to gather so far is a singular approach wherein a third-party webservice fetches all the required details and updates it back to the CRM at scheduled intervals (Let's say every 2 to 5 minutes).

How would you suggest Tim that we handle this approach request you to please shed some light on the same as well.

Highly appreciate your suggestions here.

Thanks,

PureCloud doesn't have any outbound webhooks. There are two ways to go about this, depending on the desired behavior and a few caveats.

First, you can use the notification service to subscribe to queue conversations and get events whenever they change, including when a wrap up code is set. This option will allow you to keep the CRM up to date in real time and can be done using client credentials. The limitation is that the notifications are scoped to conversations in a queue or assigned to a user, so depending on what you're subscribing to and how large your org is, you may run up against the max limits on channels (see the linked doc for specifics). The downsides to this option are that it may take more dev effort to process the notifications intelligently and also that there is the potential to miss notifications if you drop your connection; there is no retry on notifications.

Second, you could the Analytics APIs, specifically POST /api/v2/analytics/conversations/details/query, to query for ended conversations (conversationEnd exists) at a regular interval and update the CRM with the results. This option can also be done with client credentials, but introduces a delay in updating the CRM because it's batch processing. However, I'd recommend this approach because this process isn't subject to maintaining an active connection and can always re-run intervals if necessary.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.