chore: updated template to gradezco client to register chat journaling from omnihit into the contact tasks activities
parent
cb840280fb
commit
900074adb1
|
|
@ -0,0 +1,117 @@
|
||||||
|
{
|
||||||
|
"authentication":{
|
||||||
|
"type": "basic",
|
||||||
|
"userName": "_INTEGRACAO_",
|
||||||
|
"passWord": "p3G44K10366",
|
||||||
|
"crmPhoneTest":"+5511998765123",
|
||||||
|
"crmAccountId":"1000320"
|
||||||
|
},
|
||||||
|
"crmRest":[
|
||||||
|
{
|
||||||
|
"createContactRecord":{
|
||||||
|
"request":{
|
||||||
|
"requestContentType":"application/json",
|
||||||
|
"requestEncoding":"Json",
|
||||||
|
"requestType":"Post",
|
||||||
|
"responseType":"Json",
|
||||||
|
"url":"https://my365398.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ContactCollection"
|
||||||
|
},
|
||||||
|
"body":{
|
||||||
|
"LastName":"crmLastName",
|
||||||
|
"FirstName":"crmFirstName",
|
||||||
|
"Mobile":"+crmPhone",
|
||||||
|
"AccountID":"1000320"
|
||||||
|
},
|
||||||
|
"response":{
|
||||||
|
"id":"d.results.ContactID",
|
||||||
|
"objectId":"d.results.ObjectID"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lookupContactByPhone":{
|
||||||
|
"request":{
|
||||||
|
"requestContentType":"application/json",
|
||||||
|
"requestEncoding":"Json",
|
||||||
|
"requestType":"Get",
|
||||||
|
"responseType":"Json",
|
||||||
|
"url":"https://my365398.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ContactCollection?$select=ObjectID,FirstName,LastName,Email,StatusCode,StatusCodeText,Phone,Mobile,NormalisedMobile,ContactID&$filter=NormalisedMobile eq '%2BcrmPhone'"
|
||||||
|
},
|
||||||
|
"response":{
|
||||||
|
"phone":"d.results[0].NormalisedMobile",
|
||||||
|
"id":"d.results[0].ContactID",
|
||||||
|
"objectId":"d.results[0].ObjectID"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"callJournaling":{
|
||||||
|
"request":{
|
||||||
|
"requestContentType":"application/json",
|
||||||
|
"requestEncoding":"Json",
|
||||||
|
"requestType":"Post",
|
||||||
|
"responseType":"Json",
|
||||||
|
"url":"https://my365398.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/PhoneCallCollection"
|
||||||
|
},
|
||||||
|
"calls":[
|
||||||
|
{
|
||||||
|
"inboundAnsweredCall":{
|
||||||
|
"Subject": "Ligação recebida",
|
||||||
|
"Status": "1",
|
||||||
|
"InitiatorCode": "2",
|
||||||
|
"DataOriginTypeCode": "3",
|
||||||
|
"MainAccountPartyID": "1000320",
|
||||||
|
"MainContactPartyID":"crmContactId"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outboundAnsweredCall":{
|
||||||
|
"Subject": "Ligação Realizada",
|
||||||
|
"Status": "1",
|
||||||
|
"InitiatorCode": "3",
|
||||||
|
"DataOriginTypeCode": "3",
|
||||||
|
"MainAccountPartyID": "1000320",
|
||||||
|
"MainContactPartyID":"crmContactId"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"chatJournaling":{
|
||||||
|
"request":{
|
||||||
|
"requestContentType":"application/json",
|
||||||
|
"requestEncoding":"Json",
|
||||||
|
"requestType":"Post",
|
||||||
|
"responseType":"Json",
|
||||||
|
"url":"https://my365398.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/TasksCollection"
|
||||||
|
},
|
||||||
|
"chats":[
|
||||||
|
{
|
||||||
|
"chatDone":{
|
||||||
|
"Subject": "URL de la conversación en omnihit",
|
||||||
|
"Status": "1",
|
||||||
|
"PriorityCode": "3",
|
||||||
|
"MainContactPartyID": "crmContactId",
|
||||||
|
"TasksTextCollection": {
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"Text": "Conversación iniciada por WhatsApp. URL de la conversación de Ominhit: chatLink",
|
||||||
|
"TypeCode": "10002"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"redirectLink":{
|
||||||
|
"request":{
|
||||||
|
"url":"https://my365398.crm.ondemand.com/sap/public/byd/runtime?bo_ns=http%3A%2F%2Fsap.com%2FthingTypes&bo=COD_GENERIC&node=Root&operation=OnExtInspect¶m.Type=COD_CONTACT_TT¶m.InternalID=crmContactId"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ async function whatsappJournalingCRM(companyId, crmPhone = '', crmAgent, crmFirs
|
||||||
// Record whatsapp conversation that happened in omnihit v2
|
// Record whatsapp conversation that happened in omnihit v2
|
||||||
let chatJournaling = findProperty(rest, 'chatJournaling')
|
let chatJournaling = findProperty(rest, 'chatJournaling')
|
||||||
|
|
||||||
console.log('===============> chatJournaling: ', chatJournaling)
|
console.log('===============> chatJournaling: ', JSON.stringify(chatJournaling, null, 6))
|
||||||
|
|
||||||
|
|
||||||
if (chatJournaling) {
|
if (chatJournaling) {
|
||||||
|
|
@ -60,16 +60,9 @@ async function whatsappJournalingCRM(companyId, crmPhone = '', crmAgent, crmFirs
|
||||||
|
|
||||||
console.log('===============> body2: ', body)
|
console.log('===============> body2: ', body)
|
||||||
body = JSON.parse(body)
|
body = JSON.parse(body)
|
||||||
console.log('===============> body3: ', body)
|
console.log('===============> body3: ', JSON.stringify(body, null, 6))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await journalingRequest(request, body, crmCallDuration = 0, contact, crmAgent, crmPhone, authentication, rest, companyId, dynamicBodyRequest)
|
await journalingRequest(request, body, crmCallDuration = 0, contact, crmAgent, crmPhone, authentication, rest, companyId, dynamicBodyRequest)
|
||||||
|
|
||||||
// Se vier um novo status (__newLeadStatus), executa PATCH aproveitando as validações do fluxo de Activity
|
// Se vier um novo status (__newLeadStatus), executa PATCH aproveitando as validações do fluxo de Activity
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue