{ "scriptContent": { "header": { "scriptName": "Salesforce\\SF AA Chat (to export)", "busNo": 4606881, "mediaType": 3, "mediaTypeName": "chat", "purposeType": "General", "variableRedaction": "", "nextActionId": 25, "status": "Active", "lastSavedIn": "cxs" }, "actions": { "1": { "actionId": 1, "libraryId": "45A72B54-4407-4F10-B9AE-464FF02DBB3C", "name": "TEXTMSG", "version": 1, "label": "No Response (Retry)", "dependencyOrder": "0", "implType": "0", "x": 2240, "y": 368, "xws": 2240, "yws": 368 }, "2": { "actionId": 2, "libraryId": "93FB8888-30CF-4DF3-8ED9-1F2986819080", "name": "END", "version": 1, "label": "End", "dependencyOrder": "1", "implType": "0", "x": 2752, "y": 256, "xws": 2752, "yws": 256 }, "3": { "actionId": 3, "libraryId": "B2F794C5-0232-40E7-9830-76D573BF57D7", "name": "BEGIN", "version": 1, "label": "Begin", "dependencyOrder": "2", "implType": "0", "x": 1568, "y": 256, "xws": 1568, "yws": 256 }, "4": { "actionId": 4, "libraryId": "4B611BA4-8E81-45A6-9FCC-97C24F43CCBC", "name": "ONANSWER", "version": 1, "label": "Onanswer", "dependencyOrder": "3", "implType": "0", "x": 144, "y": 448, "xws": 144, "yws": 448 }, "5": { "actionId": 5, "libraryId": "EA1363D4-FADE-4CAC-B15E-C4C514C2F9B5", "name": "ONRELEASE", "version": 1, "label": "Onrelease", "dependencyOrder": "4", "implType": "0", "x": 144, "y": 576, "xws": 144, "yws": 576 }, "6": { "actionId": 6, "libraryId": "93FB8888-30CF-4DF3-8ED9-1F2986819080", "name": "END", "version": 1, "label": "End", "dependencyOrder": "5", "implType": "0", "x": 1080, "y": 576, "xws": 1080, "yws": 576 }, "7": { "actionId": 7, "libraryId": "CD5E2559-0451-4C75-83BE-597E770F5246", "name": "ASKCALLER", "version": 1, "label": "Textmsg", "dependencyOrder": "6", "implType": "0", "x": 2000, "y": 264, "xws": 2000, "yws": 264 }, "8": { "actionId": 8, "libraryId": "A10F9F27-A5DD-48BA-AE37-E206FC6E101B", "name": "LOOP", "version": 1, "label": "Loop", "dependencyOrder": "7", "implType": "0", "x": 2240, "y": 264, "xws": 2240, "yws": 264 }, "9": { "actionId": 9, "libraryId": "45A72B54-4407-4F10-B9AE-464FF02DBB3C", "name": "TEXTMSG", "version": 1, "label": "No Response (End)", "dependencyOrder": "8", "implType": "0", "x": 2496, "y": 264, "xws": 2496, "yws": 264 }, "11": { "actionId": 11, "libraryId": "B333DA63-33C8-4297-A58A-E9546CF7F0F2", "name": "SNIPPET", "version": 1, "label": "Send Data to Salesforce", "dependencyOrder": "9", "implType": "0", "x": 760, "y": 432, "xws": 760, "yws": 432 }, "12": { "actionId": 12, "libraryId": "B333DA63-33C8-4297-A58A-E9546CF7F0F2", "name": "SNIPPET", "version": 1, "label": "Update Chat Status Flag", "dependencyOrder": "10", "implType": "0", "x": 760, "y": 560, "xws": 760, "yws": 560 }, "14": { "actionId": 14, "libraryId": "B333DA63-33C8-4297-A58A-E9546CF7F0F2", "name": "SNIPPET", "version": 1, "label": "Salesforce Auth", "dependencyOrder": "8", "implType": "0", "x": 1760, "y": 240, "xws": 1760, "yws": 240 }, "17": { "actionId": 17, "libraryId": "45A72B54-4407-4F10-B9AE-464FF02DBB3C", "name": "TEXTMSG", "version": 1, "label": "Send Message in Current Conv ID", "dependencyOrder": "12", "implType": "0", "x": 760, "y": 688, "xws": 760, "yws": 688 }, "18": { "actionId": 18, "libraryId": "DE09A7DE-6654-4642-A86A-87FFBE75C7D7", "name": "ONSIGNAL", "version": 1, "label": "Onsignal", "dependencyOrder": "13", "implType": "0", "x": 144, "y": 680, "xws": 144, "yws": 680 }, "21": { "actionId": 21, "libraryId": "B2AEDEE9-AB1E-4923-9D64-04CEE8118482", "name": "AgentAssistV1_LIBID_b2aedee9-ab1e-4923-9d64-04cee8118482", "version": 1, "label": "Agent Assist", "dependencyOrder": "14", "implType": "1", "x": 1080, "y": 432, "xws": 1080, "yws": 432 }, "22": { "actionId": 22, "libraryId": "B333DA63-33C8-4297-A58A-E9546CF7F0F2", "name": "SNIPPET", "version": 1, "label": "Custom Data", "dependencyOrder": "15", "implType": "0", "x": 400, "y": 432, "xws": 400, "yws": 432 }, "23": { "actionId": 23, "libraryId": "689A4A1B-FA0D-47B3-9A02-CBEB4735F08F", "name": "REQAGENT", "version": 1, "label": "Reqagent", "dependencyOrder": "16", "implType": "0", "x": 2000, "y": 416, "xws": 2000, "yws": 416 }, "24": { "actionId": 24, "libraryId": "B333DA63-33C8-4297-A58A-E9546CF7F0F2", "name": "SNIPPET", "version": 1, "label": "Send EndOfConversation Event to Kore Agent AI", "dependencyOrder": "17", "implType": "0", "x": 400, "y": 560, "xws": 400, "yws": 560 } }, "properties": { "1": { "0": { "name": "Target", "value": "CallerFromSystem" }, "1": { "name": "Text", "value": "I would really love to help, but I'm afraid I need your account number first." } }, "2": {}, "3": { "0": { "name": "RootFolder", "value": "" }, "1": { "name": "Application", "value": "" }, "2": { "name": "ParamCount", "value": "" }, "3": { "name": "Parameters", "value": [] } }, "4": { "0": { "name": "SkillNameVar", "value": "SKLNAME" }, "1": { "name": "AgentFirstName", "value": "FIRST" }, "2": { "name": "AgentLastName", "value": "LAST" }, "3": { "name": "AgentID", "value": "AGENTID" } }, "5": { "0": { "name": "CauseCode", "value": "" }, "1": { "name": "CallResult", "value": "" } }, "6": {}, "7": { "0": { "name": "Message", "value": "Hello !" }, "1": { "name": "ResultVar", "value": "AccountNumber" }, "2": { "name": "AlertSound", "value": "" }, "3": { "name": "TimeoutSec", "value": "60" } }, "8": { "0": { "name": "Repeat", "value": "2" }, "1": { "name": "CounterName", "value": "C1" } }, "9": { "0": { "name": "Target", "value": "CallerFromSystem" }, "1": { "name": "Text", "value": "Sorry,no agent available. Please try again!" } }, "11": { "0": { "name": "Data", "value": "// Insert the records after authentication \r\nIF access_token!=''\r\n{\r\n // set request body\r\n DYNAMIC agent_Details\r\n agent_Details.KAA__contact__c=\"{contactid}\"\r\n agent_Details.KAA__agentId__c=\"{agentid}\"\r\n agent_Details.KAA__status__c=\"true\"\r\n agent_Details.KAA__screenPopup__c=\"false\"\r\n agent_Details.KAA__customData__c=\"{customdata_string}\"\r\n requestBody=\"{agent_Details.asJSON()}\"\r\n \r\n \r\n existingUserProxy=GetRESTProxy()\r\n existingUserProxy.ContentType=\"application/json\" // set content type\r\n ASSIGN requestAuth=\"Bearer \"\r\n requestAuth.append(\"{access_token}\")\r\n existingUserProxy.AddHeader(\"Authorization\",requestAuth)\r\n existingUserProxy.ContentType=\"application/json\"\r\n ASSIGN SobjectName=\"KAA__CxoneData__c\" //set sobject name\r\n ASSIGN salesforceSobjectURI=\"{salesforceBaseURI}/services/data/v58.0/sobjects/{SobjectName}\" // set endpoint url\r\n responsedBody=existingUserProxy.MakeRestRequest(salesforceSobjectURI, requestBody ,0, \"POST\")\r\n sObjectId=\"{responsedBody.id.$value}\"\r\n}\r\n" }, "1": { "name": "MaxStringSize", "value": "Limit2K" } }, "12": { "0": { "name": "Data", "value": "// set request body\r\nDYNAMIC agent_Details_update\r\nagent_Details_update.KAA__status__c='false'\r\nreqBody=\"{agent_Details_update.asJSON()}\"\r\n\r\nexistingUserProxy=GetRESTProxy()\r\nexistingUserProxy.ContentType=\"application/json\" // set content type\r\n\r\nASSIGN requestAuth=\"Bearer \"\r\nrequestAuth.append(\"{access_token}\")\r\n\r\nexistingUserProxy.AddHeader(\"Authorization\",requestAuth)\r\nexistingUserProxy.ContentType=\"application/json\"\r\n\r\nASSIGN SobjectName=\"KAA__CxoneData__c\" //set sobject name\r\nASSIGN salesforcesobjectURI=\"{salesforceBaseURI}/services/data/v58.0/sobjects/{SobjectName}/{sObjectId}\" // set endpoint url\r\nrespBody=existingUserProxy.MakeRestRequest(salesforcesobjectURI, reqBody ,0, \"PATCH\")\r\n" }, "1": { "name": "MaxStringSize", "value": "Limit2K" } }, "14": { "0": { "name": "Data", "value": "//User Authentication\r\nASSIGN global:access_token=\"\" // assign global variable\r\nASSIGN global:sObjectId=\"\" // assign global variable\r\n\r\n\r\nASSIGN global:salesforceBaseURI=\"TO-BE-FILLED-IN\" // set baseurl\r\nASSIGN salesforcekey=\"TO-BE-FILLED-IN\" //ClientID\r\nASSIGN salesforcesecret=\"TO-BE-FILLED-IN\" //ClientSecret\r\nASSIGN salesforceusername=\"TO-BE-FILLED-IN\" //SF Username\r\nASSIGN salesforcepassword=\"TO-BE-FILLED-IN\" //SF Password\r\n\r\n//Agent AI Configuration\r\nASSIGN global:clientsecret=\"Kore.ai ClientSecret\"\r\nASSIGN global:clientid=\"Kore.ai ClientID\"\r\nASSIGN global:botid=\"Kore.ai BotID\"\r\nASSIGN global:baseurl=\"Kore.ai AgentAI Widget URL\"\r\nASSIGN global:language=\"en\"\r\n\r\n\r\nASSIGN salesforcekey=salesforcekey.urlencode\r\nASSIGN salesforcesecret=salesforcesecret.urlencode\r\nASSIGN salesforceusername=salesforceusername.urlencode\r\nASSIGN salesforcepassword=salesforcepassword.urlencode\r\n\r\n\r\ntokenproxy=GetRESTProxy()\r\nASSIGN tokenRequestParms=\"\"\r\n\r\ntokenRequestParms.append(\"grant_type=password\")\r\ntokenRequestParms.append(\"&client_id={salesforcekey}\")\r\ntokenRequestParms.append(\"&client_secret={salesforcesecret}\")\r\ntokenRequestParms.append(\"&username={salesforceusername}\")\r\ntokenRequestParms.append(\"&password={salesforcepassword}\")\r\n\r\n\r\nASSIGN salesforceAuthURI=\"{salesforceBaseURI}/services/oauth2/token\" // set endpoint url\r\n\r\n\r\ntokenResult=tokenproxy.MakeRestRequest(salesforceAuthURI, tokenrequestParms, 0, \"POST\")\r\nIF tokenproxy.StatusCode = 200\r\n{\r\n access_token=\"{tokenResult.access_token.$value}\"\r\n}\r\n" }, "1": { "name": "MaxStringSize", "value": "Limit2K" } }, "17": { "0": { "name": "Target", "value": "BothFromAgent" }, "1": { "name": "Text", "value": "{P1}" } }, "18": { "0": { "name": "SrcContactIDVar", "value": "S1" }, "1": { "name": "ParamCount", "value": "" }, "2": { "name": "Parameters", "value": [] } }, "21": { "0": { "name": "assistLaunchConfigName", "value": "KAA" }, "1": { "name": "actionRestUrl", "value": "" }, "2": { "name": "AgentId", "value": "" }, "3": { "name": "AgentUUId", "value": "" }, "4": { "name": "AgentAssistMasterId", "value": "" }, "5": { "name": "BotExchangeVersion", "value": "" }, "6": { "name": "scriptParams", "value": "" } }, "22": { "0": { "name": "Data", "value": "//'customdata' object can be utilized to pass information to Agent AI Bot\n//For example, customdata.agentId = \"{agentid}\"\nDYNAMIC customdata\n\nASSIGN global:customdata_string = \"{customdata.asJSON()}\"" }, "1": { "name": "MaxStringSize", "value": "Limit2K" } }, "23": { "0": { "name": "Skill", "value": "Default" }, "1": { "name": "TargetAgent", "value": "" }, "2": { "name": "PriorityManagement", "value": "DefaultfromSkill" }, "3": { "name": "InitialPriority", "value": "0" }, "4": { "name": "Acceleration", "value": "1" }, "5": { "name": "Function", "value": "" }, "6": { "name": "MaxPriority", "value": "1000" }, "7": { "name": "Sequence", "value": "" }, "8": { "name": "ZipTone", "value": "AfterSequence" }, "9": { "name": "ScreenPopSource", "value": "DefaultFromSkill" }, "10": { "name": "ScreenPopURL", "value": "" }, "11": { "name": "HighProficiency", "value": "1" }, "12": { "name": "LowProficiency", "value": "20" }, "13": { "name": "RoutingAttribute", "value": "NotApplicable" } }, "24": { "0": { "name": "Data", "value": "DYNAMIC params\nparams.conversationId = \"{contactid}\"\nparams.botid = \"{botid}\"\nparams.clientid=\"{clientid}\"\nparams.clientsecret=\"{clientsecret}\"\nparams.baseurl=\"{baseurl}\"\nparams.language=\"{language}\"\nrequestBody = \"{params.asJSON()}\"\n\nexistingUserProxy = GetRESTProxy()\nexistingUserProxy.ContentType = \"application/json\" // set content type\n\nASSIGN tempArr = \"{baseurl.split('/')}\"\n\nASSIGN baseURI = \"{tempArr[1]}\"\nbaseURI.append(\"/\")\nbaseURI.append(\"{tempArr[2]}\")\nbaseURI.append(\"/\")\nbaseURI.append(\"{tempArr[3]}\")\n\nASSIGN summaryURI = \"{baseURI}/integrations/nice/triggerSummary\" //set endpoint url\nresponsedBody = existingUserProxy.MakeRestRequest(summaryURI, requestBody ,0, \"POST\")\n\nASSIGN responseString=\"{responsedBody.asJSON()}\"" }, "1": { "name": "MaxStringSize", "value": "Limit2K" } } }, "branches": { "1": [ { "to": 7, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "l,r", "lineType": "straight", "elbows": [] } ], "3": [ { "to": 14, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "4": [ { "to": 22, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "5": [ { "to": 24, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "7": [ { "to": 8, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] }, { "to": 23, "label": "CallerResponded", "type": "branch", "labelDistance": 0.5, "index": 1, "ports": "b,t", "lineType": "straight", "elbows": [ [ 2064, 360 ] ] } ], "8": [ { "to": 9, "label": "Finished", "type": "branch", "labelDistance": 0.5, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] }, { "to": 1, "label": "Repeat", "type": "branch", "labelDistance": 0.5, "index": 1, "ports": "b,t", "lineType": "straight", "elbows": [] } ], "9": [ { "to": 2, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "11": [ { "to": 21, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "12": [ { "to": 6, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "14": [ { "to": 7, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "18": [ { "to": 17, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "22": [ { "to": 11, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ], "24": [ { "to": 12, "label": "", "type": "default", "labelDistance": null, "index": 0, "ports": "r,l", "lineType": "straight", "elbows": [] } ] }, "schemaVersion": "1.0.0" } }