1 回答

TA貢獻(xiàn)2016條經(jīng)驗 獲得超9個贊
收據(jù)卡在 Messenger 中得到正式支持,但由于通道連接器錯誤而無法工作。我已在內(nèi)部提交了該錯誤的申請。同時,解決方法是使用 Facebook Messenger 的收據(jù)模板并將 Messenger 平臺模板作為渠道數(shù)據(jù)發(fā)送。
在 Node.js 中發(fā)送收據(jù)卡的簡單示例:
this.onMessage(async context => {
? await context.sendActivity({
? ? 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'
? ? ? ? ? ? }
? ? ? ? ? ]
? ? ? ? }
? ? ? }
? ? }
? });
});
要創(chuàng)建實現(xiàn) LINE 特定消息類型的消息,請將活動對象的通道數(shù)據(jù)屬性設(shè)置為指定 LINE 消息類型和操作類型的 JSON 對象。這將指導(dǎo)您了解如何使用 LINE 特定消息的 channelData 屬性。
希望這可以幫助。
- 1 回答
- 0 關(guān)注
- 105 瀏覽
添加回答
舉報