Chat APIs for third-party integration
Pega implementations use third-party applications for a chat along with the Pega Customer Service application. In such scenarios, synchronizing data between applications is required to maintain proper application context. In many cases, customized and siloed APIs are used to synchronize customer data and interaction data between the third party and the Pega Customer Service application. This approach to supporting each added application in the enterprise layer increases the maintenance costs and the manpower that is needed to fix bugs that are specific to an application.
Pega Customer Service 8.1 provides a standardized, generic set of JavaScript API to communicate and synchronize the data between various applications. The JavaScript APIs support the following actions.
- Create interaction – Used to create an interaction.
- Syntax:
pega.CS.startInteraction(<Interaction Class name>,<Flow name>,{<Flow params and additional params>}, callback)
- Example:
pega.CS.startInteraction("PegaCA-Work-Interaction-Call","CPMInteraction”, {ContactId:"CONT-1”, AccountNumber:"xxxxxxxxxxxxx",IsExternalAPICall:"true"},function(data){ console.log(data);})
- To create an interaction object whenever an API is called, update the SetInteractionDetails data transform by setting the When condition with the IsExternalAPICall:"true parameter.
- Syntax:
- Switch interaction – Used to switch between multiple interactions.
- Syntax:
pega.CS. switchInteraction (<Interaction ID>, callback)
- Example:
pega.CS.switchInteraction("I-123", function(data){ console.log(data);})
- Syntax:
- End interaction – Used to close any open interaction object.
- Syntax:
pega.CS. endInteraction (<Interaction ID>, callback)
- Example:
pega.CS.endInteraction("I-456", function(data){ console.log(data);})
- Syntax: