{% extends "layouts/workspace_settings.html" %} {% load common_extras %} {% comment %} Connect a Facebook page. Same shape as telegram_connect.html — see the note there for why content_wrap is cleared and why the platform key is written once. The standing "not configured" banner is .alert-warning rather than .alert-error: it describes a deployment state, usually somebody else's job and true before the operator has done anything at all. The messages.error raised on POST stays an error, because that one IS the answer to an action. Restyled only. The env var names and Meta's own UI labels are what somebody follows along with in another tab, so they stay on the page. {% endcomment %} {% block title %}Connect Facebook Messenger · DemandTrail Messaging{% endblock %} {% block content_wrap %}{% endblock %} {% block content %} {% with platform_key="messenger" %}
{% include "partials/_platform_icon.html" with platform=platform_key size="lg" only %}

Connect a Facebook page

Messenger connects through Facebook Login for Business. You sign in to Facebook, choose which page to connect, and we store that page's access token encrypted. It is never shown again.

{% if not configured %}
{{ not_configured_message }}
{% endif %}

Before you start

  1. Create a Meta app of type Business and add the Messenger and Facebook Login for Business products to it.
  2. Add this exact redirect URI to Facebook Login for Business → Valid OAuth Redirect URIs.
    {% include "partials/_copy_field.html" with label="Valid OAuth Redirect URI" value=callback_url only %}
  3. Set the app's ID and secret on this deployment as PLATFORM_MESSENGER_CLIENT_ID and PLATFORM_MESSENGER_CLIENT_SECRET.
  4. Set PLATFORM_MESSENGER_VERIFY_TOKEN and paste the same value into the Messenger webhook's Verify token field.
{% csrf_token %}

Choose the page

You will be sent to Facebook to sign in and pick which page to connect.

What happens next

What we ask Facebook for
Webhook fields we subscribe the page to

Once you pick a page we subscribe it to these and configure its Get Started button, so the welcome trigger can fire.

To serve pages other than your own app's test page, Meta requires App Review and Business Verification. Full setup notes are in docs/channels/messenger.md.

Back to channels
{% endwith %} {% endblock %}