fix: Remove fallback phone_number search in WhatsApp event processing (#6904)
This commit is contained in:
@@ -2,7 +2,7 @@ class Webhooks::WhatsappEventsJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(params = {})
|
||||
channel = find_channel_from_whatsapp_business_payload(params) || find_channel(params)
|
||||
channel = find_channel_from_whatsapp_business_payload(params)
|
||||
return if channel_is_inactive?(channel)
|
||||
|
||||
case channel.provider
|
||||
@@ -23,7 +23,7 @@ class Webhooks::WhatsappEventsJob < ApplicationJob
|
||||
false
|
||||
end
|
||||
|
||||
def find_channel(params)
|
||||
def find_channel_by_url_param(params)
|
||||
return unless params[:phone_number]
|
||||
|
||||
Channel::Whatsapp.find_by(phone_number: params[:phone_number])
|
||||
@@ -33,9 +33,9 @@ class Webhooks::WhatsappEventsJob < ApplicationJob
|
||||
# for the case where facebook cloud api support multiple numbers for a single app
|
||||
# https://github.com/chatwoot/chatwoot/issues/4712#issuecomment-1173838350
|
||||
# we will give priority to the phone_number in the payload
|
||||
return unless params[:object] == 'whatsapp_business_account'
|
||||
return get_channel_from_wb_payload(params) if params[:object] == 'whatsapp_business_account'
|
||||
|
||||
get_channel_from_wb_payload(params)
|
||||
find_channel_by_url_param(params)
|
||||
end
|
||||
|
||||
def get_channel_from_wb_payload(wb_params)
|
||||
|
||||
Reference in New Issue
Block a user