feat(integration/omnihit): update config to allow ticket creation without assigned queue

master
adriano 2025-04-11 12:58:35 -03:00
parent 6497728899
commit 9705157bdd
3 changed files with 17 additions and 11 deletions

View File

@ -273,7 +273,7 @@ const testTemplate = async (req, res) => {
crmOauth = crmOauth.toObject() crmOauth = crmOauth.toObject()
const { crmPhoneTest } = crmOauth.crm.authentication const { crmPhoneTest } = crmOauth.crm.authentication
await templateValidator(crmPhoneTest, crmOauth.crm, companyId) await templateValidator(crmPhoneTest, crmOauth.crm, companyId)
crmOauth = await CRM.findOne({ 'crm.authentication.crmClientId': clientId, 'companyId': companyId }) crmOauth = await CRM.findOne({ 'crm.authentication.crmClientId': clientId, 'companyId': companyId })
@ -411,12 +411,19 @@ const webhook = async (req, res) => {
if (!req.body?.meta) if (!req.body?.meta)
return res.status(StatusCodes.OK).send() return res.status(StatusCodes.OK).send()
let { name, phone_number } = req.body.meta.sender let { name, phone_number } = req.body.meta.sender
const {id: ticketId, account_id: accountId} = req.body
const ticketId = req.body?.id //channel: 'Channel::FacebookPage'
console.log("2 =============> ticketId id: ", ticketId, " | accountId account_id: ",accountId)
// const accountId = req.body.account_id if (!phone_number) {
const accountId = "15"
console.log("=============> Ignored process phone_number: ", phone_number, " | 'Channel::FacebookPage'")
return res.send()
}
let crmPhone = phone_number.replace('+', '') let crmPhone = phone_number.replace('+', '')
@ -496,9 +503,9 @@ const webhook_crm = async (req, res) => {
}) })
console.log('==========> crm whoId: ', whoId) console.log('==========> crm whoId: ', whoId)
console.log('==========> crm contact: ', contact) console.log('==========> crm contact: ', contact)
if(!contact) return res.send() if (!contact) return res.send()
const { phone } = contact const { phone } = contact

View File

@ -10,8 +10,7 @@
}, },
"createConversation":{ "createConversation":{
"inbox_id": "2", "inbox_id": "2",
"status":"pending", "status":"pending"
"team_id": "1"
} }
} }

View File

@ -153,7 +153,7 @@ async function lookupContactByPhone(rest, authentication, crmPhone, companyId, t
} }
} }
console.log('---------> auxPhone: ', auxPhone, ' | auxContactId: ', auxContactId) console.log('---------> auxPhone: ', auxPhone, ' | auxContactId: ', auxContactId, ' | auxAccountId: ', auxAccountId)
if (auxPhone) { if (auxPhone) {