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.
This commit is contained in:
Muhsin Keloth
2025-04-10 12:58:38 +05:30
committed by GitHub
parent 73dcf539ed
commit 65cd0717e6

View File

@@ -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)