fix: ensure contact_inbox if contact exists(#5667)
- Fixing Instagram issue for existing contacts in the inbox
This commit is contained in:
parent
f740727177
commit
0343acdb7e
3 changed files with 9 additions and 6 deletions
10
Gemfile.lock
10
Gemfile.lock
|
@ -427,14 +427,14 @@ GEM
|
|||
netrc (0.11.0)
|
||||
newrelic_rpm (8.9.0)
|
||||
nio4r (2.5.8)
|
||||
nokogiri (1.13.7)
|
||||
nokogiri (1.13.9)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.13.7-arm64-darwin)
|
||||
nokogiri (1.13.9-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.13.7-x86_64-darwin)
|
||||
nokogiri (1.13.9-x86_64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.13.7-x86_64-linux)
|
||||
nokogiri (1.13.9-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
oauth (0.5.10)
|
||||
orm_adapter (0.5.0)
|
||||
|
@ -808,4 +808,4 @@ RUBY VERSION
|
|||
ruby 3.0.4p208
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.18
|
||||
2.3.16
|
||||
|
|
|
@ -13,6 +13,7 @@ class Webhooks::InstagramEventsJob < ApplicationJob
|
|||
@entries = entries
|
||||
|
||||
@entries.each do |entry|
|
||||
entry = entry.with_indifferent_access
|
||||
entry[:messaging].each do |messaging|
|
||||
send(@event_name, messaging) if event_name(messaging)
|
||||
end
|
||||
|
|
|
@ -53,8 +53,10 @@ class Instagram::MessageText < Instagram::WebhooksBaseService
|
|||
@messaging[:message][:is_deleted].present?
|
||||
end
|
||||
|
||||
# if contact was present before find out contact_inbox to create message
|
||||
def contacts_first_message?(ig_scope_id)
|
||||
@inbox.contact_inboxes.where(source_id: ig_scope_id).empty? && @inbox.channel.instagram_id.present?
|
||||
@contact_inbox = @inbox.contact_inboxes.where(source_id: ig_scope_id).last
|
||||
@contact_inbox.blank? && @inbox.channel.instagram_id.present?
|
||||
end
|
||||
|
||||
def sent_via_test_webhook?
|
||||
|
|
Loading…
Reference in a new issue