facebookfacebook-messengerfacebook-send-api

Facebook Messenger Platform Send API unexpected internal error


I'm working on my framework for Facebook Messenger Platform Send API and I've got this error when trying to create an Airline Itinerary Template (https://developers.facebook.com/docs/messenger-platform/send-api-reference/airline-itinerary-template):

{
 "error": {
   "message": "(#-1) Send API unexpected internal error",
   "type": "OAuthException",
   "code": -1,
   "fbtrace_id": "DBWbw/pHJGv"
 }
}

Here's the request that triggered it:

{  
   "message":{  
      "attachment":{  
         "type":"template",
         "payload":{  
            "flight_info":[  
               {  
                  "connection_id":"123",
                  "segment_id":"123",
                  "aircraft_type":"Boeing",
                  "travel_class":"business",
                  "flight_number":"123",
                  "departure_airport":{  
                     "airport_code":"CT",
                     "city":"Catania",
                     "terminal":"F",
                     "gate":"54"
                  },
                  "arrival_airport":{  
                     "airport_code":"BG",
                     "city":"Bergamo",
                     "terminal":"C",
                     "gate":"12"
                  },
                  "flight_schedule":{  
                     "boarding_time":"2016-8-25T15:8",
                     "departure_time":"2016-8-25T15:8",
                     "arrival_time":"2016-8-25T15:8"
                  }
               }
            ],
            "passenger_info":[  
               {  
                  "passenger_id":"1",
                  "ticket_number":"215",
                  "name":"Sarah Hum"
               },
               {  
                  "passenger_id":"2",
                  "name":"Jeremy Goldberg"
               }
            ],
            "passenger_segment_info":[  
               {  
                  "segment_id":"241",
                  "passenger_id":"251",
                  "seat":"14A",
                  "seat_type":"Economy",
                  "product_info":[  
                     {  
                        "title":"Cabin",
                        "value":"Coach"
                     }
                  ]
               }
            ],
            "price_info":[  
               {  
                  "title":"Cabin",
                  "amount":100.0,
                  "currency":"USD"
               },
               {  
                  "title":"Ticket",
                  "amount":200.0
               }
            ],
            "base_price":200.71,
            "tax":200.0,
            "total_price":4032.54,
            "currency":"USD",
            "pnr_number":"D0FQTK",
            "intro_message":"Here\u0027s your itinerary",
            "locale":"en_US",
            "template_type":"airline_itinerary"
         }
      }
   },
   "recipient":{  
      "id":"************"
   }
}

At this URL: https://graph.facebook.com/v2.7/me/messages?access_token=*******

I've got this problem only with this specific template. The other works just fine. Does anybody know what may be the cause of it?

Thank you.


Solution

  • I see the below issues in your message json.

    1. The segment_id in flight_info section isn't matching the one in the passenger_segment_info section
    2. Same issue with the passenger_id field.
    3. The boarding, arrival and departure date format is wrong. You need to prefix 0 if the month, day, hour or minute is single digit.

    I tested with the above fixes and it worked fine. Here is the updated example.

    {
         "attachment":{  
         "type":"template",
         "payload":{  
            "flight_info":[  
               {  
                  "connection_id":"123",
                  "segment_id":"241",
                  "aircraft_type":"Boeing",
                  "travel_class":"business",
                  "flight_number":"123",
                  "departure_airport":{  
                     "airport_code":"CT",
                     "city":"Catania",
                     "terminal":"F",
                     "gate":"54"
                  },
                  "arrival_airport":{  
                     "airport_code":"BG",
                     "city":"Bergamo",
                     "terminal":"C",
                     "gate":"12"
                  },
                  "flight_schedule":{  
                     "boarding_time":"2016-08-25T15:08",
                     "departure_time":"2016-08-25T15:08",
                     "arrival_time":"2016-08-25T15:08"
                  }
               }
            ],
            "passenger_info":[  
               {  
                  "passenger_id":"1",
                  "ticket_number":"215",
                  "name":"Sarah Hum"
               },
               {  
                  "passenger_id":"2",
                  "name":"Jeremy Goldberg"
               }
            ],
            "passenger_segment_info":[  
               {  
                  "segment_id":"241",
                  "passenger_id":"1",
                  "seat":"14A",
                  "seat_type":"Economy",
                  "product_info":[  
                     {  
                        "title":"Cabin",
                        "value":"Coach"
                     }
                  ]
               }
            ],
            "price_info":[  
               {  
                  "title":"Cabin",
                  "amount":100.0,
                  "currency":"USD"
               },
               {  
                  "title":"Ticket",
                  "amount":200.0
               }
            ],
            "base_price":200.71,
            "tax":200.0,
            "total_price":4032.54,
            "currency":"USD",
            "pnr_number":"D0FQTK",
            "intro_message":"Here\u0027s your itinerary",
            "locale":"en_US",
            "template_type":"airline_itinerary"
         }
      }
    },
    

    I hope Facebook will someday update the documentation with the details about these constraints. Please share your bug ticket link here so that we can subscribe to it.