feat: getting company id from accountId
parent
89db3e83c9
commit
1d300e07ca
|
@ -438,38 +438,38 @@ const webhook = async (req, res) => {
|
||||||
let crmPhone = phone_number.replace('+', '')
|
let crmPhone = phone_number.replace('+', '')
|
||||||
|
|
||||||
|
|
||||||
// TEST
|
|
||||||
const company = await Company.findOne({
|
const company = await Company.findOne({
|
||||||
integrations: {
|
integrations: {
|
||||||
$elemMatch: {
|
$elemMatch: {
|
||||||
name: "omnihit",
|
name: "omnihit",
|
||||||
"config.accountId": "15"
|
"config.accountId": accountId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!company) {
|
||||||
|
return res.status(StatusCodes.NOT_FOUND).send({ msg: "companyId not found!" })
|
||||||
|
}
|
||||||
|
|
||||||
console.log("======> company omnihit: ", company)
|
console.log("======> company omnihit: ", company)
|
||||||
//
|
|
||||||
|
|
||||||
const companies = [
|
// const companies = [
|
||||||
// { companyId: "99", account_id: "1" },
|
// // { companyId: "99", account_id: "1" },
|
||||||
{ companyId: "99", account_id: "15" },
|
// { companyId: "99", account_id: "15" },
|
||||||
]
|
// ]
|
||||||
|
|
||||||
|
// const obj = companies.find(c => +c.account_id == +accountId)
|
||||||
|
|
||||||
const obj = companies.find(c => +c.account_id == +accountId)
|
|
||||||
|
|
||||||
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: ', obj.companyId)
|
console.log('=======> companyId: ', company.companyId)
|
||||||
|
|
||||||
console.log('=======> ticketId: ', ticketId)
|
console.log('=======> ticketId: ', ticketId)
|
||||||
|
|
||||||
|
|
||||||
await whatsappJournalingCRM(
|
await whatsappJournalingCRM(
|
||||||
companyId = obj.companyId,
|
companyId = company.companyId,
|
||||||
crmPhone = crmPhone,
|
crmPhone = crmPhone,
|
||||||
crmAgent = '0000',
|
crmAgent = '0000',
|
||||||
crmFirstName = name,
|
crmFirstName = name,
|
||||||
|
|
Loading…
Reference in New Issue