Facebook Messenger Platform 发送 API 意外内部错误
Facebook Messenger Platform Send API unexpected internal error
我正在为 Facebook Messenger Platform Send API 开发框架,但在尝试创建航空公司行程模板 (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"
}
}
这是触发它的请求:
{
"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":"************"
}
}
此时URL:https://graph.facebook.com/v2.7/me/messages?access_token=*********
我只遇到这个特定模板的问题。另一个工作得很好。有谁知道可能是什么原因造成的?
谢谢。
我遇到了同样的问题,你试过 2.6 API 版本吗?
https://graph.facebook.com/v2.6/me/messages?access_token=*******
我刚刚尝试使用 CURL 请求,它在 facebook 文档示例中运行良好
curl -X POST -H "Content-Type: application/json" -d '{
"recipient": {
"id": "XXXX"
},
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "airline_itinerary",
"intro_message": "Heres your flight itinerary.",
"locale": "en_US",
"pnr_number": "ABCDEF",
"passenger_info": [
{
"name": "Farbound Smith Jr",
"ticket_number": "0741234567890",
"passenger_id": "p001"
},
{
"name": "Nick Jones",
"ticket_number": "0741234567891",
"passenger_id": "p002"
}
],
"flight_info": [
{
"connection_id": "c001",
"segment_id": "s001",
"flight_number": "KL9123",
"aircraft_type": "Boeing 737",
"departure_airport": {
"airport_code": "SFO",
"city": "San Francisco",
"terminal": "T4",
"gate": "G8"
},
"arrival_airport": {
"airport_code": "SLC",
"city": "Salt Lake City",
"terminal": "T4",
"gate": "G8"
},
"flight_schedule": {
"departure_time": "2016-01-02T19:45",
"arrival_time": "2016-01-02T21:20"
},
"travel_class": "business"
},
{
"connection_id": "c002",
"segment_id": "s002",
"flight_number": "KL321",
"aircraft_type": "Boeing 747-200",
"travel_class": "business",
"departure_airport": {
"airport_code": "SLC",
"city": "Salt Lake City",
"terminal": "T1",
"gate": "G33"
},
"arrival_airport": {
"airport_code": "AMS",
"city": "Amsterdam",
"terminal": "T1",
"gate": "G33"
},
"flight_schedule": {
"departure_time": "2016-01-02T22:45",
"arrival_time": "2016-01-03T17:20"
}
}
],
"passenger_segment_info": [
{
"segment_id": "s001",
"passenger_id": "p001",
"seat": "12A",
"seat_type": "Business"
},
{
"segment_id": "s001",
"passenger_id": "p002",
"seat": "12B",
"seat_type": "Business"
},
{
"segment_id": "s002",
"passenger_id": "p001",
"seat": "73A",
"seat_type": "World Business",
"product_info": [
{
"title": "Lounge",
"value": "Complimentary lounge access"
},
{
"title": "Baggage",
"value": "1 extra bag 50lbs"
}
]
},
{
"segment_id": "s002",
"passenger_id": "p002",
"seat": "73B",
"seat_type": "World Business",
"product_info": [
{
"title": "Lounge",
"value": "Complimentary lounge access"
},
{
"title": "Baggage",
"value": "1 extra bag 50lbs"
}
]
}
],
"price_info": [
{
"title": "Fuel surcharge",
"amount": "1597",
"currency": "USD"
}
],
"base_price": "12206",
"tax": "200",
"total_price": "14003",
"currency": "USD"
}
}
}
}' 'https://graph.facebook.com/v2.6/me/messages?access_token=xxxxx'
我在您的消息中看到以下问题 json。
- flight_info 部分中的 segment_id 与 passenger_segment_info 部分中的不匹配
- passenger_id 字段存在同样的问题。
- 登机、到达和离开日期格式错误。如果月、日、小时或分钟是个位数,则需要前缀 0。
我用上述修复程序进行了测试,效果很好。这是更新后的示例。
{
"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"
}
}
},
我希望 Facebook 有一天会更新文档,其中包含有关这些限制的详细信息。请在此处分享您的问题单 link,以便我们订阅。
我正在为 Facebook Messenger Platform Send API 开发框架,但在尝试创建航空公司行程模板 (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"
}
}
这是触发它的请求:
{
"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":"************"
}
}
此时URL:https://graph.facebook.com/v2.7/me/messages?access_token=*********
我只遇到这个特定模板的问题。另一个工作得很好。有谁知道可能是什么原因造成的?
谢谢。
我遇到了同样的问题,你试过 2.6 API 版本吗?
https://graph.facebook.com/v2.6/me/messages?access_token=*******
我刚刚尝试使用 CURL 请求,它在 facebook 文档示例中运行良好
curl -X POST -H "Content-Type: application/json" -d '{
"recipient": {
"id": "XXXX"
},
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "airline_itinerary",
"intro_message": "Heres your flight itinerary.",
"locale": "en_US",
"pnr_number": "ABCDEF",
"passenger_info": [
{
"name": "Farbound Smith Jr",
"ticket_number": "0741234567890",
"passenger_id": "p001"
},
{
"name": "Nick Jones",
"ticket_number": "0741234567891",
"passenger_id": "p002"
}
],
"flight_info": [
{
"connection_id": "c001",
"segment_id": "s001",
"flight_number": "KL9123",
"aircraft_type": "Boeing 737",
"departure_airport": {
"airport_code": "SFO",
"city": "San Francisco",
"terminal": "T4",
"gate": "G8"
},
"arrival_airport": {
"airport_code": "SLC",
"city": "Salt Lake City",
"terminal": "T4",
"gate": "G8"
},
"flight_schedule": {
"departure_time": "2016-01-02T19:45",
"arrival_time": "2016-01-02T21:20"
},
"travel_class": "business"
},
{
"connection_id": "c002",
"segment_id": "s002",
"flight_number": "KL321",
"aircraft_type": "Boeing 747-200",
"travel_class": "business",
"departure_airport": {
"airport_code": "SLC",
"city": "Salt Lake City",
"terminal": "T1",
"gate": "G33"
},
"arrival_airport": {
"airport_code": "AMS",
"city": "Amsterdam",
"terminal": "T1",
"gate": "G33"
},
"flight_schedule": {
"departure_time": "2016-01-02T22:45",
"arrival_time": "2016-01-03T17:20"
}
}
],
"passenger_segment_info": [
{
"segment_id": "s001",
"passenger_id": "p001",
"seat": "12A",
"seat_type": "Business"
},
{
"segment_id": "s001",
"passenger_id": "p002",
"seat": "12B",
"seat_type": "Business"
},
{
"segment_id": "s002",
"passenger_id": "p001",
"seat": "73A",
"seat_type": "World Business",
"product_info": [
{
"title": "Lounge",
"value": "Complimentary lounge access"
},
{
"title": "Baggage",
"value": "1 extra bag 50lbs"
}
]
},
{
"segment_id": "s002",
"passenger_id": "p002",
"seat": "73B",
"seat_type": "World Business",
"product_info": [
{
"title": "Lounge",
"value": "Complimentary lounge access"
},
{
"title": "Baggage",
"value": "1 extra bag 50lbs"
}
]
}
],
"price_info": [
{
"title": "Fuel surcharge",
"amount": "1597",
"currency": "USD"
}
],
"base_price": "12206",
"tax": "200",
"total_price": "14003",
"currency": "USD"
}
}
}
}' 'https://graph.facebook.com/v2.6/me/messages?access_token=xxxxx'
我在您的消息中看到以下问题 json。
- flight_info 部分中的 segment_id 与 passenger_segment_info 部分中的不匹配
- passenger_id 字段存在同样的问题。
- 登机、到达和离开日期格式错误。如果月、日、小时或分钟是个位数,则需要前缀 0。
我用上述修复程序进行了测试,效果很好。这是更新后的示例。
{
"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"
}
}
},
我希望 Facebook 有一天会更新文档,其中包含有关这些限制的详细信息。请在此处分享您的问题单 link,以便我们订阅。