Class: InstagramConnect::Ingest::Handlers::MessagingHandover
- Defined in:
- lib/instagram_connect/ingest/handlers/messaging_handover.rb
Overview
Thread control moving between apps — typically between this app and the Page Inbox a human operator uses.
This matters beyond bookkeeping: the Send API rejects a message on a thread another app owns, so a send has to read thread_owner_app_id first rather than discovering it as an opaque API error.
Constant Summary collapse
- CONTROL_KEYS =
%w[pass_thread_control take_thread_control request_thread_control].freeze
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from InstagramConnect::Ingest::Handlers::Base
Class Method Details
.dedupe_key(event) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/instagram_connect/ingest/handlers/messaging_handover.rb', line 13 def self.dedupe_key(event) sender = event.dig("sender", "id") key = CONTROL_KEYS.find { |k| event[k] } return nil if key.nil? [ sender, event["timestamp"], key, event.dig(key, "new_owner_app_id") ].compact.join(":") end |
Instance Method Details
#call ⇒ Object
21 22 23 24 |
# File 'lib/instagram_connect/ingest/handlers/messaging_handover.rb', line 21 def call conversation.register_thread_control(owner_app_id: new_owner_app_id, at: handed_over_at) conversation end |