Facebook Messenger,发送回执时暂时发送消息失败
Facebook Messenger, Temporary send message failure when sending receipt
我想用虚拟数据向用户发送我的收据。
我使用 this library 简化了向 Facebook 发送消息的过程。
我的有效载荷的结构是这样的:
var payload = {
template_type: 'receipt',
recipient_name: '@' + user.name + ' ' + user.surname,
order_number: (new Date).getTime(),
currency: 'USD',
payment_method: 'Наличными',
order_url: 'http://www.example.com',
timestamp: (new Date).getTime() + '',
elements: [
{
title: title,
subtitle: subtitle,
quantity: 1,
price: 20,
currency: 'USD',
image_url: image_url
}
],
address: {
street_1:"Nurly tau",
street_2:"",
city:"Almaty",
postal_code:"050000",
state:"KZ",
country:"KZ"
},
summary: {
subtotal: 20,
shipping_cost: 0,
total_tax: 0,
total_cost: 20
},
adjustments: []
};
我刚刚用简单的假数据填充了收据字段。此外,Facebook 会跟踪所有已发送收据的 order_numbers
的唯一性。
当我尝试发送此收据时收到一条错误消息:
{ message: '(#1200) Temporary send message failure. Please try again later',
type: 'OAuthException',
code: 1200,
fbtrace_id: 'BHmHRCEQUC4' }
这个错误是什么意思? Facebook 的错误信息如此神秘?
我遇到了同样的问题,经过多次尝试,我发现问题出在与 JSON 有效负载一起传递的 timestamp
参数上。
我不知道它可能是什么,但它对我删除它很有用。 (也许,时间戳应该 在 调用 API 之前的片刻,我不知道)。
我刚刚遇到了同样的问题,经过一些摆弄后我弄明白了!问题是,当您使用 (new Date).getTime()
构造时间戳时,它 returns 自纪元以来的 毫秒 的数量。但是,Facebook 要求它以秒为单位。
我想用虚拟数据向用户发送我的收据。
我使用 this library 简化了向 Facebook 发送消息的过程。
我的有效载荷的结构是这样的:
var payload = {
template_type: 'receipt',
recipient_name: '@' + user.name + ' ' + user.surname,
order_number: (new Date).getTime(),
currency: 'USD',
payment_method: 'Наличными',
order_url: 'http://www.example.com',
timestamp: (new Date).getTime() + '',
elements: [
{
title: title,
subtitle: subtitle,
quantity: 1,
price: 20,
currency: 'USD',
image_url: image_url
}
],
address: {
street_1:"Nurly tau",
street_2:"",
city:"Almaty",
postal_code:"050000",
state:"KZ",
country:"KZ"
},
summary: {
subtotal: 20,
shipping_cost: 0,
total_tax: 0,
total_cost: 20
},
adjustments: []
};
我刚刚用简单的假数据填充了收据字段。此外,Facebook 会跟踪所有已发送收据的 order_numbers
的唯一性。
当我尝试发送此收据时收到一条错误消息:
{ message: '(#1200) Temporary send message failure. Please try again later',
type: 'OAuthException',
code: 1200,
fbtrace_id: 'BHmHRCEQUC4' }
这个错误是什么意思? Facebook 的错误信息如此神秘?
我遇到了同样的问题,经过多次尝试,我发现问题出在与 JSON 有效负载一起传递的 timestamp
参数上。
我不知道它可能是什么,但它对我删除它很有用。 (也许,时间戳应该 在 调用 API 之前的片刻,我不知道)。
我刚刚遇到了同样的问题,经过一些摆弄后我弄明白了!问题是,当您使用 (new Date).getTime()
构造时间戳时,它 returns 自纪元以来的 毫秒 的数量。但是,Facebook 要求它以秒为单位。