fix: updated to include last name in call journaling
parent
9db7604b93
commit
cb840280fb
|
|
@ -89,7 +89,7 @@
|
|||
"chats":[
|
||||
{
|
||||
"chatDone":{
|
||||
"Text": "Conversation started via WhatsApp. Conversation link: chatLink"
|
||||
"Text": "Conversación iniciada por WhatsApp. URL de la conversación de Ominhit: chatLink"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ const deleteCompany = async (req, res) => {
|
|||
const callJournaling = async (req, res) => {
|
||||
|
||||
try {
|
||||
let { companyId, operation, crmPhone, crmAgent, crmCallDuration, crmFirstName, operationStatus } = req.body
|
||||
let { companyId, operation, crmPhone, crmAgent, crmCallDuration, crmFirstName, crmLastName, operationStatus } = req.body
|
||||
|
||||
console.log(`[REQ.BODY - ${new Date()}] callJournaling: `, JSON.stringify(req.body, null, 6))
|
||||
|
||||
|
|
@ -229,10 +229,11 @@ const callJournaling = async (req, res) => {
|
|||
crmCallDuration = "10"
|
||||
|
||||
|
||||
console.log("=======================> crmLastName: ", crmLastName)
|
||||
|
||||
|
||||
if (operationStatus == "hangup")
|
||||
await journaling(companyId, operation, crmPhone, crmAgent, crmCallDuration, crmFirstName)
|
||||
// crmLastName
|
||||
if (operationStatus == "hangup")
|
||||
await journaling(companyId, operation, crmPhone, crmAgent, crmCallDuration, crmFirstName, crmLastName)
|
||||
|
||||
|
||||
else if (operationStatus == "update-answer") {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const sendMessageSocket = require('./sendMessageSocket')
|
|||
|
||||
async function createContact(companyId, rest, authentication, crmPhone = '', crmFirstName = 'Username', crmLastName = 'Last name', crmEmail = '', test = {}, dynamicBodyRequest = {}) {
|
||||
let { request, body, response } = findProperty(rest, 'createContactRecord')
|
||||
|
||||
|
||||
const { requestContentType, requestEncoding, requestType, responseType, url } = request
|
||||
|
||||
// O identificador a ser usado na requisição (prioriza telefone, mas usa e-mail se não houver)
|
||||
|
|
@ -65,7 +65,7 @@ async function createContact(companyId, rest, authentication, crmPhone = '', crm
|
|||
|
||||
console.log('#####################')
|
||||
console.log('CREATE CONTACT PAYLOAD: ', JSON.stringify(config, null, 6))
|
||||
console.log('#####################')
|
||||
console.log('#####################')
|
||||
|
||||
if (dynamicBodyRequest && Object.keys(dynamicBodyRequest) !== 0) {
|
||||
config.data = { ...config.data, ...dynamicBodyRequest }
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const findProperty = require('./findProperty')
|
|||
|
||||
const journalingRequest = require('./journalingRequest')
|
||||
|
||||
async function journaling(companyId, operation, crmPhone, crmAgent, crmCallDuration = 0, crmFirstName ='Username') {
|
||||
async function journaling(companyId, operation, crmPhone, crmAgent, crmCallDuration = 0, crmFirstName ='Username', crmLastName = 'Last name') {
|
||||
|
||||
const crmFiles = await loadCRM(companyId)
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ async function journaling(companyId, operation, crmPhone, crmAgent, crmCallDurat
|
|||
let contact = await lookupContactByPhone(rest, authentication, crmPhone, companyId)
|
||||
|
||||
if (!contact.exist) {
|
||||
contact = await createContact(companyId, rest, authentication, crmPhone, crmFirstName)
|
||||
contact = await createContact(companyId, rest, authentication, crmPhone, crmFirstName, crmLastName)
|
||||
}
|
||||
|
||||
let { request, calls, response } = findProperty(rest, 'callJournaling')
|
||||
|
|
|
|||
Loading…
Reference in New Issue