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