feat: implemented find companyId by omnihit accountId
parent
1d300e07ca
commit
f05bfa4047
|
@ -437,12 +437,11 @@ const webhook = async (req, res) => {
|
||||||
|
|
||||||
let crmPhone = phone_number.replace('+', '')
|
let crmPhone = phone_number.replace('+', '')
|
||||||
|
|
||||||
|
|
||||||
const company = await Company.findOne({
|
const company = await Company.findOne({
|
||||||
integrations: {
|
integrations: {
|
||||||
$elemMatch: {
|
$elemMatch: {
|
||||||
name: "omnihit",
|
name: "omnihit",
|
||||||
"config.accountId": accountId
|
"config.accountId": `${accountId}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -451,15 +450,6 @@ const webhook = async (req, res) => {
|
||||||
return res.status(StatusCodes.NOT_FOUND).send({ msg: "companyId not found!" })
|
return res.status(StatusCodes.NOT_FOUND).send({ msg: "companyId not found!" })
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
console.log('=======> name: ', name)
|
||||||
console.log('=======> crmPhone: ', crmPhone)
|
console.log('=======> crmPhone: ', crmPhone)
|
||||||
console.log('=======> accountId: ', accountId)
|
console.log('=======> accountId: ', accountId)
|
||||||
|
@ -535,8 +525,6 @@ 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) {
|
||||||
|
@ -567,15 +555,6 @@ 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,
|
||||||
|
|
Loading…
Reference in New Issue