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.

Callback

This triggers the opt-in callback.