feat: get company by omnihit accountId
parent
344dafbb48
commit
89db3e83c9
|
@ -423,10 +423,10 @@ const webhook = async (req, res) => {
|
|||
|
||||
let { name, phone_number } = req.body.meta.sender
|
||||
|
||||
const {id: ticketId, account_id: accountId} = req.body
|
||||
const { id: ticketId, account_id: accountId } = req.body
|
||||
|
||||
//channel: 'Channel::FacebookPage'
|
||||
console.log("2 =============> ticketId id: ", ticketId, " | accountId account_id: ",accountId)
|
||||
console.log("2 =============> ticketId id: ", ticketId, " | accountId account_id: ", accountId)
|
||||
|
||||
if (!phone_number) {
|
||||
|
||||
|
@ -437,11 +437,27 @@ const webhook = async (req, res) => {
|
|||
|
||||
let crmPhone = phone_number.replace('+', '')
|
||||
|
||||
|
||||
// TEST
|
||||
const company = await Company.findOne({
|
||||
integrations: {
|
||||
$elemMatch: {
|
||||
name: "omnihit",
|
||||
"config.accountId": "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)
|
||||
|
||||
console.log('=======> name: ', name)
|
||||
|
|
Loading…
Reference in New Issue