Skip to content

Log in button

Updated: Jun 17, 2026

The log in button triggers the account linking authentication flow, which lets you link the message recipient's identity on Messenger with their account on your site by directing them to your web-based login flow for authentication.

For more on using the log in button for account linking, see Account linking.

Supported usage

The log in button supports the following templates:

  • Generic template
  • List template
  • Button template
  • Media template

Properties

PropertyTypeDescription
typeStringMust be account_link.
urlStringAuthentication callback URL. Must use HTTPS protocol.

Sample request

curl -X POST "https://graph.facebook.com/<LATEST_API_VERSION>/<PAGE_ID>/messages?access_token=<PAGE_ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": {
      "id": "<PSID>"
    },
    "message": {
      "attachment": {
        "type": "template",
        "payload": {
          "template_type": "button",
          "text": "Try the log in button!",
          "buttons": [
            {
              "type": "account_link",
              "url": "https://www.example.com/authorize"
            }
          ]
        }
      }
    }
  }'

Sample response

A successful request to send a log in button returns the following Send API response:

{
  "recipient_id": "1254477777772919",
  "message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P"
}

Unofficial mirror for reference/search purposes. All content originates from developers.facebook.com — see the source link at the top of each page. Machine-readable indexes: llms.txt · llms-full.txt · About