Request URI

https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>

Example Request

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient": {
    "id": "<PSID>"
  },
  "message": {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "airline_boardingpass",
        "intro_message": "You are checked in.",
        "locale": "en_US",
        "boarding_pass": [
          {
            "passenger_name": "SMITH\/NICOLAS",
            "pnr_number": "CG4X7U",
            "seat": "74J",            
            "logo_image_url": "https:\/\/www.example.com\/en\/logo.png",
            "header_image_url": "https:\/\/www.example.com\/en\/fb\/header.png",
            "qr_code": "M1SMITH\/NICOLAS  CG4X7U nawouehgawgnapwi3jfa0wfh",
            "above_bar_code_image_url": "https:\/\/www.example.com\/en\/PLAT.png",
            "auxiliary_fields": [
              {
                "label": "Terminal",
                "value": "T1"
              },
              {
                "label": "Departure",
                "value": "30OCT 19:05"
              }
            ],
            "secondary_fields": [
              {
                "label": "Boarding",
                "value": "18:30"
              },
              {
                "label": "Gate",
                "value": "D57"
              },
              {
                "label": "Seat",
                "value": "74J"
              },
              {
                "label": "Sec.Nr.",
                "value": "003"
              }
            ],
            "flight_info": {
              "flight_number": "KL0642",
              "departure_airport": {
                "airport_code": "JFK",
                "city": "New York",
                "terminal": "T1",
                "gate": "D57"
              },
              "arrival_airport": {
                "airport_code": "AMS",
                "city": "Amsterdam"
              },
              "flight_schedule": {
                "departure_time": "2016-01-02T19:05",
                "arrival_time": "2016-01-05T17:30"
              }
            }
          }
        ]
      }
    }
  }
}' 'https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>'

Example Response

{
  "recipient_id": "1254477777772919",
  "message_id": "mid.$cAAJsujCd2ORj_1qmrFdzhVa-4cvO"
}  

Properties

recipient

Description of the message recipient. All requests must include one of id, phone_number, or user_ref.

Property Type Description

recipient.id

String

PSID of the message recipient. Either PSID or phone_number must be set.

recipient.phone_number

String

Optional. Phone number of the recipient with the format +1(212)555-2368.


Your bot must be approved for Customer Matching to send messages this way.

recipient.user_ref

String

Optional. user_ref from the checkbox plugin.

recipient.name

Object

Optional. Used only if phone_number is set. Specifies the person's name in the format:


{"first_name":"John", "last_name":"Doe"}

Providing a name increases the odds of a successful match.

message

Description of the message to be sent.
Property Type Description

message.attachment

Object

An object describing attachments to the message.

message.attachment

Property Type Description

type

String

Value must be template

payload

Object

payload of the template.

message.attachment.payload

Property Name Type Description

template_type

String

Value must be airline_boardingpass

intro_message

String

Introduction message

locale

String

Two-letter language region code. Must be a two-letter ISO 639-1 language code and a ISO 3166-1 alpha-2 region code separated by an underscore character. Used to translate field labels (e.g. en_US). See this document for more information about Facebook's locale support.

theme_color

String

Optional. Background color of the attachment. Must be a RGB hexadecimal string. Defaults to #009ddc.

boarding_pass

Array<boarding_pass>

Boarding passes for passengers

message.attachment.payload.boarding_pass

Property Name Type Required Description

passenger_name

String

Flight number

pnr_number

String

Passenger name record number (Booking Number)

travel_class

String

Optional.. Travel class.

seat

String

Optional. Seat number for passenger.

auxiliary_fields

Array<auxiliary_field>

Optional. Flexible information to display in the auxiliary section.

secondary_fields

Array<secondary_field>

Optional. Flexible information to display in the secondary section.

logo_image_url

String

URL for the logo image

header_image_url

String

Optional. URL for the header image.

header_text_field

field

Optional. Text for the header field.

qr_code

String

Aztec or QR code. Not available if barcode_image_urlis used.

barcode_image_url

String

URL of the barcode image. Not available if qr_code is used.

above_bar_code_image_url

String

URL of thin image above the barcode.

flight_info

Object

Information about the flight. See flight_info.

message.attachment.payload.boarding_pass.auxiliary_field

Property Type Description

label

String

Label for the additional field

value

String

Value for the additional field

message.attachment.payload.boarding_pass.secondary_field

Property Type Description

label

String

Label for the additional field

value

String

Value for the additional field

message.attachment.payload.boarding_pass.flight_info

Property Name Type Description

flight_number

String

Flight number

departure_airport

Object

Departure airport. See departure_airport.

arrival_airport

Object

Arrival airport. See arrival_airport.

flight_schedule

Object

Schedule for the flight. See flight_schedule.

message.attachment.payload.boarding_pass.flight_info.flight_schedule

Property Name Type Description

boarding_time

String

Optional. Boarding time in departure airport timezone. Must be in the ISO 8601-based format YYYY-MM-DDThh:mm (e.g. 2015-09-26T10:30).

departure_time

String

Departure time in departure airport timezone. Must be in the ISO 8601-based format YYYY-MM-DDThh:mm (e.g. 2015-09-26T10:30).

arrival_time

String

Optional. Arrival time in arrival airport timezone. Must be in the ISO 8601-based format YYYY-MM-DDThh:mm (e.g. 2015-09-26T10:30).

message.attachment.payload.boarding_pass.flight_info.departure_airport

Property Type Description

airport_code

String

Airport code of the departure airport.

city

String

Departure city of the flight.

terminal

String

Terminal of the departing flight.

gate

String

Gate for the departing flight.

message.attachment.payload.boarding_pass.flight_info.arrival_airport

Property Type Description

airport_code

String

Airport code of the arrival airport.

city

String

Arrival city of the flight.