Class: InstagramConnect::Ingest::Handlers::MessagingSeen

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

Overview

A read receipt: the customer has seen everything up to this message.

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



6
7
8
9
10
# File 'lib/instagram_connect/ingest/handlers/messaging_seen.rb', line 6

def self.dedupe_key(event)
  mid = event.dig("read", "mid").presence or return nil

  "#{event.dig('sender', 'id')}:#{mid}"
end

Instance Method Details

#callObject



12
13
14
15
# File 'lib/instagram_connect/ingest/handlers/messaging_seen.rb', line 12

def call
  conversation.mark_read_by_customer(at: seen_at, mid: mid)
  conversation
end