chore: Disable error tracking for Whatsapp error webhooks (#6627)
https://developers.facebook.com/docs/whatsapp/on-premises/webhooks/components We are not going to handle the WhatsApp error component webhook event. https://chatwoot-p3.sentry.io/issues/3957884597/?project=4504723538771968&query=is%3Aunresolved&referrer=issue-stream Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
@@ -56,6 +56,8 @@ class Whatsapp::IncomingMessageBaseService
|
||||
return if unprocessable_message_type?(message_type)
|
||||
|
||||
message = @processed_params[:messages].first
|
||||
log_error(message) && return if error_webhook_event?(message)
|
||||
|
||||
if message_type == 'contacts'
|
||||
create_contact_messages(message)
|
||||
else
|
||||
|
||||
@@ -46,4 +46,12 @@ module Whatsapp::IncomingMessageServiceHelpers
|
||||
def unprocessable_message_type?(message_type)
|
||||
%w[reaction ephemeral unsupported].include?(message_type)
|
||||
end
|
||||
|
||||
def error_webhook_event?(message)
|
||||
message.key?('errors')
|
||||
end
|
||||
|
||||
def log_error(message)
|
||||
Rails.logger.warn "Whatsapp Error: #{message['errors'][0]['title']} - contact: #{message['from']}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user