fix: contact is not available for inaccessible sender (#5509)
Fixes: #5508 We can not read contact information because of this error, as the messages echo when the sender sends messages to contacts. We don't have the user's consent until and unless they send messages to us. So after this result, information about the contact is empty, and we are trying to create a contact inbox for the same, and the error appears. type: OAuthException, code: 230, message: (#230) User consent is required to access user profile, x-fb-trace-id: AaitxF/whwY [HTTP 403] (Koala::Facebook::ClientError)
This commit is contained in:
@@ -42,7 +42,7 @@ class Instagram::MessageText < Instagram::WebhooksBaseService
|
||||
ChatwootExceptionTracker.new(e, account: @inbox.account).capture_exception
|
||||
end
|
||||
|
||||
find_or_create_contact(result)
|
||||
find_or_create_contact(result) if result.present?
|
||||
end
|
||||
|
||||
def agent_message_via_echo?
|
||||
@@ -71,6 +71,8 @@ class Instagram::MessageText < Instagram::WebhooksBaseService
|
||||
end
|
||||
|
||||
def create_message
|
||||
return unless @contact_inbox
|
||||
|
||||
Messages::Instagram::MessageBuilder.new(@messaging, @inbox, outgoing_echo: agent_message_via_echo?).perform
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user