Monday, December 9, 2019

How To Store The Pre Chat Details in Live Agent Transcript Object Using REST API

In my previous post we have learn how to pass the pre-chat details in REST API and how it shown to agent etc .Now,if you want to store this information in ChatTranscript (Object Name -LiveChatTranscript ) for future reference we can do it easily just by setting few things the same request body by making some changes at "transcriptFields":[] property in the request.

This information will get stored only after agent has ended the chat conversation with customer and if has chosen a option to store the transcript.

First,please goto the ChatTranscript object and create a custom fields to store the required data.

In my scenario I want to store the product category and price .So,I have created 3 new fields as Category__c,Product_Category__c,Price_Range__c. Product which comes from the chat request I want to store it 2 custom fields called Category__c,Product_Category__c and Price range in Price_Range__c.


API Details:


Headers:
X-LIVEAGENT-API-VERSION:34
X-LIVEAGENT-AFFINITYaffinityToken from SessionId API
X-LIVEAGENT-SESSION-KEYkey from from SessionId API
X-LIVEAGENT-SEQUENCE:1
Content-Type:application/json



Sample Request:

{
  "organizationId": "000008afQ",
  "deploymentId": "57228",
  "buttonId": "57328",
  "sessionId": "id-from-response",
  "userAgent": "Lynx/2.8.8",
  "language": "en-US",
  "screenResolution": "1900x1080",
  "visitorName": "Frank Underwood",
  "prechatEntities": [
    
  ],
  "receiveQueueUpdates": true,
  "isPost": true,
  "prechatDetails": [
   {
      "label": "Price Range",
      "value": "20,000-30,000",
      "displayToAgent": true,
      "transcriptFields": [ "Price_Range__c"],
      "entityFieldMaps": [
        
      ]
    },
{ "label": "Product Category", "value": "Smart Phone", "displayToAgent": true, "transcriptFields": ["Category__c","Product_Category__c"], "entityFieldMaps": [ ] }, { "label": "Description", "value": "I'm looking for a mobile with 8GB RAM and 256 GB ROM ", "displayToAgent": true, "transcriptFields": [ ], "entityFieldMaps": [ ] } ] }

Sample Response:

["Ok","200"]

                                             Hope this helps you..Enjoy..!

3 comments:

  1. This is really nice post, I love this content also visit Free Chat Room Malaysia. Thanks for sharing.

    ReplyDelete
  2. How to use the fields passed in the request to populate into case

    ReplyDelete