Skip to main content

Setup

You will need a Facebook Page with Messenger enabled and a Facebook App with the Messenger platform configured. In Courier, navigate to the Facebook Messenger Integration page, enter your Page Access Token, then click “Save.”

Profile Requirements

To deliver a message to a recipient over Facebook Messenger, Courier must be provided the recipient’s Page-Scoped ID (PSID). The value should be included in the recipient profile as facebookPSID.
{
  "message": {
    "to": {
      "facebookPSID": "1254477777772919"
    }
  }
}

Overrides

Body Overrides

You can override any of the fields in the request body that Courier sends to the Messenger Send API.
{
  "message": {
    "template": "NOTIFICATION_TEMPLATE_ID",
    "to": {
      "facebookPSID": "1254477777772919"
    },
    "providers": {
      "facebook-messenger": {
        "override": {
          "body": {
            "messaging_type": "UPDATE"
          }
        }
      }
    }
  }
}

Config Overrides

You can swap the Page Access Token or API URL at send time:
{
  "message": {
    "template": "NOTIFICATION_TEMPLATE_ID",
    "to": {
      "facebookPSID": "1254477777772919"
    },
    "providers": {
      "facebook-messenger": {
        "override": {
          "config": {
            "access_token": "RUNTIME_PAGE_ACCESS_TOKEN"
          }
        }
      }
    }
  }
}