Compare commits
No commits in common. "f05bfa4047fbb84348712848544e093f3b93f960" and "344dafbb48ff3d938a4912e642793d88c21f8fec" have entirely different histories.
f05bfa4047
...
344dafbb48
|
|
@ -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,29 +437,23 @@ const webhook = async (req, res) => {
|
|||
|
||||
let crmPhone = phone_number.replace('+', '')
|
||||
|
||||
const company = await Company.findOne({
|
||||
integrations: {
|
||||
$elemMatch: {
|
||||
name: "omnihit",
|
||||
"config.accountId": `${accountId}`
|
||||
}
|
||||
}
|
||||
})
|
||||
const companies = [
|
||||
// { companyId: "99", account_id: "1" },
|
||||
{ companyId: "99", account_id: "15" },
|
||||
]
|
||||
|
||||
if (!company) {
|
||||
return res.status(StatusCodes.NOT_FOUND).send({ msg: "companyId not found!" })
|
||||
}
|
||||
const obj = companies.find(c => +c.account_id == +accountId)
|
||||
|
||||
console.log('=======> name: ', name)
|
||||
console.log('=======> crmPhone: ', crmPhone)
|
||||
console.log('=======> accountId: ', accountId)
|
||||
console.log('=======> companyId: ', company.companyId)
|
||||
console.log('=======> companyId: ', obj.companyId)
|
||||
|
||||
console.log('=======> ticketId: ', ticketId)
|
||||
|
||||
|
||||
await whatsappJournalingCRM(
|
||||
companyId = company.companyId,
|
||||
companyId = obj.companyId,
|
||||
crmPhone = crmPhone,
|
||||
crmAgent = '0000',
|
||||
crmFirstName = name,
|
||||
|
|
@ -525,6 +519,8 @@ const webhook_crm = async (req, res) => {
|
|||
|
||||
const { phone } = contact
|
||||
|
||||
// const obj = omnihitV2Integration.find(o => o.companyId == companyId)
|
||||
|
||||
const config = await getIntegrationsConfig(companyId, 'omnihit')
|
||||
|
||||
if (config) {
|
||||
|
|
@ -555,6 +551,15 @@ const webhook_crm = async (req, res) => {
|
|||
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 = {
|
||||
contactCreate,
|
||||
uploadCrmConfig,
|
||||
|
|
|
|||
Loading…
Reference in New Issue