Node.js Bot framework V4如何添加带折扣的facebook收据
是否可以在Bot Framework V4中使用Facebook Messenger收据模板中的折扣选项 因为我尝试搜索样本,但它们需要字符串值,而Facebook模板需要数组 例如:Node.js Bot framework V4如何添加带折扣的facebook收据,node.js,botframework,Node.js,Botframework,是否可以在Bot Framework V4中使用Facebook Messenger收据模板中的折扣选项 因为我尝试搜索样本,但它们需要字符串值,而Facebook模板需要数组 例如: "adjustments":[ { "name":"New Customer Discount", "amount":20 }, { "name":"$10 Off Coupon", "amount":10
"adjustments":[
{
"name":"New Customer Discount",
"amount":20
},
{
"name":"$10 Off Coupon",
"amount":10
}
],
Facebook模板可以使用ChannelData发送。以下是带有调整的收据模板示例:
await context.sendActivity({
text: 'Receipt',
channelData: {
"attachment":{
"type":"template",
"payload": {
"template_type": "receipt",
"recipient_name": "Stephane Crozatier",
"order_number": "12345678902",
"currency": "USD",
"payment_method": "Visa 2345",
"order_url": "http://petersapparel.parseapp.com/order?order_id=123456",
"timestamp": "1428444852",
"address": {
"street_1": "1 Hacker Way",
"street_2": "",
"city": "Menlo Park",
"postal_code": "94025",
"state": "CA",
"country": "US"
},
"summary": {
"subtotal": 75.00,
"shipping_cost": 4.95,
"total_tax": 6.19,
"total_cost": 56.14
},
"adjustments": [{
"name": "New Customer Discount",
"amount": 20
},
{
"name": "$10 Off Coupon",
"amount": 10
}
],
"elements": [{
"title": "Classic White T-Shirt",
"subtitle": "100% Soft and Luxurious Cotton",
"quantity": 2,
"price": 50,
"currency": "USD",
"image_url": "http://petersapparel.parseapp.com/img/whiteshirt.png"
},
{
"title": "Classic Gray T-Shirt",
"subtitle": "100% Soft and Luxurious Cotton",
"quantity": 1,
"price": 25,
"currency": "USD",
"image_url": "http://petersapparel.parseapp.com/img/grayshirt.png"
}
]
}
}
}
});
您好,我尝试使用此模板,但facebook仅用收据文本回复我,而不是实际收据?删除channelData中的facebook对象后,一切正常。谢谢@尤金,我已经从答案中删除了这一部分。谢谢