Compare commits

..

No commits in common. "f05bfa4047fbb84348712848544e093f3b93f960" and "344dafbb48ff3d938a4912e642793d88c21f8fec" have entirely different histories.

1 changed files with 32 additions and 27 deletions

View File

@ -437,29 +437,23 @@ const webhook = async (req, res) => {
let crmPhone = phone_number.replace('+', '') let crmPhone = phone_number.replace('+', '')
const company = await Company.findOne({ const companies = [
integrations: { // { companyId: "99", account_id: "1" },
$elemMatch: { { companyId: "99", account_id: "15" },
name: "omnihit", ]
"config.accountId": `${accountId}`
}
}
})
if (!company) { const obj = companies.find(c => +c.account_id == +accountId)
return res.status(StatusCodes.NOT_FOUND).send({ msg: "companyId not found!" })
}
console.log('=======> name: ', name) console.log('=======> name: ', name)
console.log('=======> crmPhone: ', crmPhone) console.log('=======> crmPhone: ', crmPhone)
console.log('=======> accountId: ', accountId) console.log('=======> accountId: ', accountId)
console.log('=======> companyId: ', company.companyId) console.log('=======> companyId: ', obj.companyId)
console.log('=======> ticketId: ', ticketId) console.log('=======> ticketId: ', ticketId)
await whatsappJournalingCRM( await whatsappJournalingCRM(
companyId = company.companyId, companyId = obj.companyId,
crmPhone = crmPhone, crmPhone = crmPhone,
crmAgent = '0000', crmAgent = '0000',
crmFirstName = name, crmFirstName = name,
@ -525,6 +519,8 @@ const webhook_crm = async (req, res) => {
const { phone } = contact const { phone } = contact
// const obj = omnihitV2Integration.find(o => o.companyId == companyId)
const config = await getIntegrationsConfig(companyId, 'omnihit') const config = await getIntegrationsConfig(companyId, 'omnihit')
if (config) { if (config) {
@ -555,6 +551,15 @@ const webhook_crm = async (req, res) => {
return res.set('Content-Type', 'text/xml').status(StatusCodes.OK).send(responseXml) return res.set('Content-Type', 'text/xml').status(StatusCodes.OK).send(responseXml)
} }
const integration = async (req, res) => {
const { companyId } = req.query
const { integration } = req.body
console.log("====> companyId: ", companyId, " | integration: ", integration)
res.send()
}
module.exports = { module.exports = {
contactCreate, contactCreate,
uploadCrmConfig, uploadCrmConfig,