Class: InstagramConnect::InboundMessage
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- InstagramConnect::InboundMessage
- Defined in:
- app/models/instagram_connect/inbound_message.rb
Overview
At-least-once dedupe ledger keyed by Meta's message id. Lets the webhook (and any future backfill/poll) run without double-processing a message.
Class Method Summary collapse
-
.claim(ig_message_id:, account_id: nil) ⇒ Object
Returns true only the first time a given message id is claimed.
Class Method Details
.claim(ig_message_id:, account_id: nil) ⇒ Object
Returns true only the first time a given message id is claimed.
8 9 10 11 12 13 |
# File 'app/models/instagram_connect/inbound_message.rb', line 8 def self.claim(ig_message_id:, account_id: nil) create!(ig_message_id: , account_id: account_id, processed_at: Time.current) true rescue ActiveRecord::RecordNotUnique false end |