Send to Messenger Plugin

When your Facebook app is in Development Mode, plugin and API functionality will only work for admins, developers and testers of the app that have a valid session. After your app is approved and public, it will work for the general public.

The "Send to Messenger" plugin is used to trigger an authentication event to your webhook. You can pass in data to know which user and transaction was tied to the authentication event, and link the user on your back-end.

The first time a person clicks on this button, a confirmation popup will be presented.

Requirements

Facebook Javascript SDK

To use the send to Messenger plugin, you must include the Facebook for Javascript SDK in the page where the plugin will be rendered.

For instructions on including the SDK, see the Facebook for Javascript SDK Quick Start.

Whitelisted Domain

To include the send to Messenger plugin on your webpage, you must whitelist the domain of your site in your bot's Messenger profile. For more information see, whitelisted_domains.

Setup

<div class="fb-send-to-messenger" 
  messenger_app_id="<APP_ID>" 
  page_id="PAGE_ID" 
  data-ref="<PASS_THROUGH_PARAM>" 
  color="<blue | white>" 
  size="<standard | large | xlarge>">
</div>

For a complete description of available attributes, see the send to Messenger plugin reference.

Event Subscription

Subscribe to plugin events.

<script>

  FB.Event.subscribe('send_to_messenger', function(e) {
    // callback for events triggered by the plugin
  
  });

</script>

Event Fields

Field Name Type Description

event

Enum

Name of event. Possible values: rendered, clicked, not_you, opt_in.

ref

String

Contains the value set on the data-ref param on the plugin.

is_after_optin

Boolean

Indicates whether event happened after the confirmation pop-up was confirmed.

pluginID

undefined

This field is not used.

Webhook Event

The send to Messenger plugin triggers the messaging_optins webhook event.

CTA text options

The Send to Messenger plugin also supports the cta_text attribute. This allows you to choose the button text for the plugin from a pre-defined list of strings. When the cta_text attribute is used, most signed-in users will only have to click the plugin button itself to opt in, without having to re-confirm with the popup, and the messaging_optins event will be delivered immediately.

The following values are supported for the cta_text attribute:

  • GET_THIS_IN_MESSENGER
  • RECEIVE_THIS_IN_MESSENGER
  • SEND_THIS_TO_ME
  • GET_CUSTOMER_ASSISTANCE
  • GET_CUSTOMER_SERVICE
  • GET_SUPPORT
  • LET_US_CHAT
  • SEND_ME_MESSAGES
  • ALERT_ME_IN_MESSENGER
  • SEND_ME_UPDATES
  • MESSAGE_ME
  • LET_ME_KNOW
  • KEEP_ME_UPDATED
  • TELL_ME_MORE
  • SUBSCRIBE_IN_MESSENGER
  • SUBSCRIBE_TO_UPDATES
  • GET_MESSAGES
  • SUBSCRIBE
  • GET_STARTED_IN_MESSENGER
  • LEARN_MORE_IN_MESSENGER
  • GET_STARTED
  • SEND_TO_MESSENGER