From 65cd0717e6807239daee8af4c283c4ed966c1cc0 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Thu, 10 Apr 2025 12:58:38 +0530 Subject: [PATCH] fix: Handle Instagram echo events (#11275) This PR fixes the issue with message creation when someone sends messages from the Instagram app instead of the Chatwoot dashboard. --- app/builders/messages/instagram/base_message_builder.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/builders/messages/instagram/base_message_builder.rb b/app/builders/messages/instagram/base_message_builder.rb index b8f892d97..767115bc6 100644 --- a/app/builders/messages/instagram/base_message_builder.rb +++ b/app/builders/messages/instagram/base_message_builder.rb @@ -94,11 +94,10 @@ class Messages::Instagram::BaseMessageBuilder < Messages::Messenger::MessageBuil def build_message # Duplicate webhook events may be sent for the same message # when a user is connected to the Instagram account through both Messenger and Instagram login. + # There is chance for echo events to be sent for the same message. # Therefore, we need to check if the message already exists before creating it. return if message_already_exists? - return if @outgoing_echo - return if message_content.blank? && all_unsupported_files? @message = conversation.messages.create!(message_params)