Class: InstagramConnect::Ingest::Handlers::MessagingOptins

Inherits:
Base
  • Object
show all
Defined in:
lib/instagram_connect/ingest/handlers/messaging_optins.rb

Overview

The customer opted in to notification messages. There is nothing to store on the thread beyond the fact that they interacted — the opt-in token itself lives in the banked event, where a host that implements recurring notifications can read it without the gem taking a position on how that should work.

Instance Attribute Summary

Attributes inherited from Base

#notification

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from InstagramConnect::Ingest::Handlers::Base

Class Method Details

.dedupe_key(event) ⇒ Object



10
11
12
13
14
# File 'lib/instagram_connect/ingest/handlers/messaging_optins.rb', line 10

def self.dedupe_key(event)
  sender = event.dig("sender", "id").presence or return nil

  "#{sender}:#{event['timestamp']}"
end

Instance Method Details

#callObject



16
17
18
19
# File 'lib/instagram_connect/ingest/handlers/messaging_optins.rb', line 16

def call
  conversation.register_event(opted_in_at)
  conversation
end