Passing custom data to the chatbot
When a customer launches the chatbot several properties are passed on to it by default. You may have to pass additional data dynamically to alter the bot behavior or to capture some data to send to the agent during a chat escalation.
Follow these steps to do so:
- In the downloaded self-service configuration folder of your web chatbot channel, open the PegaHelperExtension.JS file.
- Update the preparePegaAParams function by adding the new key-value pairs, for example, pegaAParamObj.myparam= “Wednesday”;
- Create a new property in the Work-Channel-Chat class to hold that value, for example, MyChatServer. For more information, see Creating a property.
- In the Work-Channel-Chat class of your self-service application, update the pyDefault data transform to set .myServer to param.myParam.
- Use the SetContactContextWebChatBot data transform to copy the value set in the data transform, for example, .myServer, to the pyInteractionCase page.
pyInteractionCase page is the context of the Bot interaction.
When the customer escalates the bot interaction to a CSR, the RetrieveBotTranscript activity is used to copy items from the pyInteractionCase page of the chatbot to the CSR side.