Class: FlowChat::Instagram::Gateway::SendApi

Inherits:
Meta::MessagingGateway show all
Defined in:
lib/flow_chat/instagram/gateway/send_api.rb

Overview

Instagram DMs, on the shared Messenger Platform envelope.

A sibling of the Messenger gateway rather than a subclass of it: the two differ in credentials, limits and subscription object, and neither owns the other.

Constant Summary collapse

FACEBOOK_LOGIN_WEBHOOK_OBJECT =

Confirmed against a live delivery for a page-linked account: Meta's docs are ambiguous about whether these arrive under "page" or "instagram", and they arrive under "instagram". The delivery named the Instagram professional account in entry.id, not the linked Page, which is what webhook_account_id encodes.

"instagram"
INSTAGRAM_LOGIN_WEBHOOK_OBJECT =

Kept as its own constant rather than sharing one with the path above: the two integrations are configured independently in Meta's dashboard, so a correction to one path's value must not silently change the other's.

"instagram"

Constants included from FlowChat::Instrumentation

FlowChat::Instrumentation::DELIVERED_MESSAGE_ID_KEY, FlowChat::Instrumentation::DELIVERY_DURATION_KEY

Instance Attribute Summary

Attributes inherited from Meta::MessagingGateway

#client, #context

Attributes included from GatewayAsyncSupport

#context, #controller

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Meta::MessagingGateway

#call, configure_middleware_stack, #initialize

Methods included from Meta::GatewayIdentity

#log_tag

Methods included from GatewayAsyncSupport

#async_supported?, #enqueue_async_job, #extract_body_for_background, #extract_headers_for_background, #extract_host, #extract_path, #extract_remote_ip, #in_background?, #should_enqueue_async?, #side_events_already_published?

Methods included from FlowChat::Instrumentation

#elapsed_ms_since, #inbound_message?, #instrument, instrument, #platform_message_id_from, report_api_error, #report_delivery_failure, #report_delivery_success, #report_to_app, #report_to_subscribers

Constructor Details

This class inherits a constructor from FlowChat::Meta::MessagingGateway

Class Method Details

.choice_mapper_classObject



30
31
32
# File 'lib/flow_chat/instagram/gateway/send_api.rb', line 30

def self.choice_mapper_class
  FlowChat::Instagram::Middleware::ChoiceMapper
end

Instance Method Details

#client_classObject



22
23
24
# File 'lib/flow_chat/instagram/gateway/send_api.rb', line 22

def client_class
  FlowChat::Instagram::Client
end

#configuration_classObject



18
19
20
# File 'lib/flow_chat/instagram/gateway/send_api.rb', line 18

def configuration_class
  FlowChat::Instagram::Configuration
end

#expected_webhook_objectObject



47
48
49
# File 'lib/flow_chat/instagram/gateway/send_api.rb', line 47

def expected_webhook_object
  (@config. == :instagram) ? INSTAGRAM_LOGIN_WEBHOOK_OBJECT : FACEBOOK_LOGIN_WEBHOOK_OBJECT
end

#gateway_nameObject



14
15
16
# File 'lib/flow_chat/instagram/gateway/send_api.rb', line 14

def gateway_name
  :instagram_send_api
end

#platformObject



10
11
12
# File 'lib/flow_chat/instagram/gateway/send_api.rb', line 10

def platform
  :instagram
end

#renderer_classObject



26
27
28
# File 'lib/flow_chat/instagram/gateway/send_api.rb', line 26

def renderer_class
  FlowChat::Instagram::Renderer
end