23 SNIPPET Send EndOfConversation Event to Kore Agent AI DYNAMIC params params.conversationId = "{contactid}" params.botid = "{botid}" params.clientid="{clientid}" params.clientsecret="{clientsecret}" params.baseurl="{baseurl}" params.language="{language}" requestBody = "{params.asJSON()}" existingUserProxy = GetRESTProxy() existingUserProxy.ContentType = "application/json" // set content type ASSIGN tempArr = "{baseurl.split('/')}" ASSIGN baseURI = "{tempArr[1]}" baseURI.append("/") baseURI.append("{tempArr[2]}") baseURI.append("/") baseURI.append("{tempArr[3]}") ASSIGN summaryURI = "{baseURI}/integrations/nice/triggerSummary" //set endpoint url responsedBody = existingUserProxy.MakeRestRequest(summaryURI, requestBody ,0, "POST") ASSIGN responseString="{responsedBody.asJSON()}" Limit2K 5 0 464 304 11 0 b333da63-33c8-4297-a58a-e9546cf7f0f2 5 0 0 22 END End 1184 320 10 0 93fb8888-30cf-4df3-8ed9-1f2986819080 -1 0 0 21 REQAGENT Reqagent Default DefaultfromSkill 0 1 1000 AfterSequence DefaultFromSkill 1 20 NotApplicable 1184 56 9 0 689a4a1b-fa0d-47b3-9a02-cbeb4735f08f -1 0 0 20 SNIPPET Send Data to Salesforce // Insert the records after authentication IF access_token!='' { // set request body DYNAMIC agent_Details agent_Details.KAA__contact__c = "{contactid}" agent_Details.KAA__agentId__c = "{agentid}" agent_Details.KAA__status__c = "true" agent_Details.KAA__screenPopup__c="false" agent_Details.KAA__customData__c="{customdata_string}" requestBody = "{agent_Details.asJSON()}" existingUserProxy = GetRESTProxy() existingUserProxy.ContentType = "application/json" // set content type // set Authorization ASSIGN requestAuth = "Bearer " requestAuth.append("{access_token}") existingUserProxy.AddHeader("Authorization",requestAuth) existingUserProxy.ContentType = "application/json" ASSIGN SobjectName = "KAA__CxoneData__c" //set sobject name ASSIGN salesforceSobjectURI = "{salesforceBaseURI}/services/data/v58.0/sobjects/{SobjectName}" //set endpoint url responsedBody = existingUserProxy.MakeRestRequest(salesforceSobjectURI, requestBody ,0, "POST") sObjectId = "{responsedBody.id.$value}" } Limit2K 12 0 848 160 2 0 b333da63-33c8-4297-a58a-e9546cf7f0f2 12 0 0 19 SNIPPET Custom Data //'customdata' object can be utilized to pass information to Agent AI Bot //For example, customdata.agentId = "{agentid}" DYNAMIC customdata ASSIGN global:customdata_string = "{customdata.asJSON()}" Limit2K 20 0 464 160 7 0 b333da63-33c8-4297-a58a-e9546cf7f0f2 20 0 0 12 AgentAssistV1_LIBID_b2aedee9-ab1e-4923-9d64-04cee8118482 Agent Assist KAA 1184 160 6 1 b2aedee9-ab1e-4923-9d64-04cee8118482 -1 0 0 9 SNIPPET Set Credentials //NICEOPENCTI ORG //NICEOPENCTIPACKAGER ORG ASSIGN global:salesforce_key="TO-BE-FILLED-IN" //ClientID ASSIGN global:salesforce_secret="TO-BE-FILLED-IN" //ClientSecret ASSIGN global:salesforce_username="TO-BE-FILLED-IN" //SF Username ASSIGN global:salesforce_password="TO-BE-FILLED-IN" //SF Password //Agent AI Configuration ASSIGN global:clientsecret="Kore.ai ClientSecret" ASSIGN global:clientid="Kore.ai ClientID" ASSIGN global:botid="Kore.ai BotID" ASSIGN global:baseurl="Kore.ai AgentAI Widget URL" ASSIGN global:language="en" Limit2K 8 0 464 32 5 0 b333da63-33c8-4297-a58a-e9546cf7f0f2 8 0 0 8 SNIPPET User Auth //User Authentication ASSIGN global:access_token = "" // assign global varible for set access token ASSIGN global:sObjectId = "" // assign global varible for set id ASSIGN global:salesforceBaseURI = "TO-BE-FILLED-IN" // set baseurl // set credentials ASSIGN salesforcekey ="{salesforce_key}" ASSIGN salesforcesecret ="{salesforce_secret}" ASSIGN salesforceusername ="{salesforce_username}" ASSIGN salesforcepassword ="{salesforce_password}" // urlencoded form ASSIGN salesforcekey=salesforcekey.urlencode ASSIGN salesforcesecret=salesforcesecret.urlencode ASSIGN salesforceusername=salesforceusername.urlencode ASSIGN salesforcepassword=salesforcepassword.urlencode tokenproxy=GetRESTProxy() //create local variable and append credentials ASSIGN tokenRequestParms="" tokenRequestParms.append("grant_type=password") tokenRequestParms.append("&client_id={salesforcekey}") tokenRequestParms.append("&client_secret={salesforcesecret}") tokenRequestParms.append("&username={salesforceusername}") tokenRequestParms.append("&password={salesforcepassword}") ASSIGN salesforceAuthURI="{salesforceBaseURI}/services/oauth2/token" // set endpoint url tokenResult = tokenproxy.MakeRestRequest(salesforceAuthURI, tokenrequestParms, 0, "POST") //call api and store responsed in local variable // check status code and get access token IF tokenproxy.StatusCode = 200 { access_token = "{tokenResult.access_token.$value}" } Limit2K 21 0 848 32 1 0 b333da63-33c8-4297-a58a-e9546cf7f0f2 21 0 0 5 SNIPPET Update Data IF sObjectId!='' { // set request body DYNAMIC agent_Details_update agent_Details_update.KAA__status__c = 'false' reqBody = "{agent_Details_update.asJSON()}" existingUserProxy = GetRESTProxy() existingUserProxy.ContentType = "application/json" // set content type // set Authorization ASSIGN requestAuth = "Bearer " requestAuth.append("{access_token}") existingUserProxy.AddHeader("Authorization",requestAuth) existingUserProxy.ContentType = "application/json" ASSIGN SobjectName = "KAA__CxoneData__c" //set sobject name ASSIGN salesforcesobjectURI = "{salesforceBaseURI}/services/data/v58.0/sobjects/{SobjectName}/{sObjectId}" // set endpoint url respBody = existingUserProxy.MakeRestRequest(salesforcesobjectURI, reqBody ,0, "PATCH") } Limit2K 22 0 848 304 3 0 b333da63-33c8-4297-a58a-e9546cf7f0f2 22 0 0 4 ONRELEASE Onrelease 23 0 176 320 2 0 ea1363d4-fade-4cac-b15e-c4c514c2f9b5 23 0 0 3 ONANSWER Onanswer SKLNAME FIRST LAST AGENTID 19 0 176 176 1 0 4b611ba4-8e81-45a6-9fcc-97c24f43ccbc 19 0 0 1 BEGIN Begin 9 0 176 48 0 0 b2f794c5-0232-40e7-9830-76d573bf57d7 9 0 0 kore_nicecti_sf_voice 2024-10-07T12:47:10.15 2025-03-18T11:36:13.62 44030417 XOCC Kore.ai Mountain Standard Time 4 0001-01-01T00:00:00