Facebook Messenger Graph API中的Carousel元素序列不正确

问题描述 投票:0回答:1

我正在尝试使用信使平台文档中描述的通用模板在Facebook工作场所平台上发送水平滚动轮播消息(参考:https://developers.facebook.com/docs/messenger-platform/reference/template/generic

我使用的模板看起来像这样:

[
  {
    "text": "Hi!!!!"
  },
  {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "generic",
        "elements": [
          {
            "title": "Some Title 1",
            "image_url": "some image url",
            "buttons": [
              {
                "title": "button_title1",
                "type": "postback",
                "payload": "Title 1"
              }
            ]
          },
          {
            "title": "Some Title 2",
            "image_url": "some image url",
            "buttons": [
              {
                "title": "button_title2",
                "type": "postback",
                "payload": "Title 2"
              }
            ]
          },{
            "title": "Some Title 3",
            "image_url": "some image url",
            "buttons": [
              {
                "title": "button_title3",
                "type": "postback",
                "payload": "Title 3"
              }
            ]
          },

        ]
      }
    }
  }
]

一切都按照我的预期工作,但是,从过去2周左右开始,轮播元素(在我的情况下是卡片)的顺序并不是我所期望的(即Title1,Title2,Title3)。每次使用时,旋转木马中的元素都以不同的顺序显示。我只是想知道是否有其他人有同样的问题,或者它与我的代码有什么关系?

我用来发送消息的代码最后是:

return new Promise((resolve, reject) => {
    //(async ref:https://www.npmjs.com/package/async)
    async.eachSeries(

            //facebookMessages is the message template that I am using(posted above)
            facebookMessages,
            (msg, callback) => {

            //sendFBSenderAction sends the message to FB using api(https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>)
            this.sendFBSenderAction(sender, 'typing_on')
            .then(() => this.sleep(this.messagesDelay))
            .then(() => {
                facebookMessages.attachment ? this.sendFbAttachment(msg) : this.sendFBMessage(sender, msg);
                facebookMessages.attachment = false;
            })
            .then(() => callback())
            .catch(callback);
        },
        err => {
            if (err) {
                console.error(err);
                reject(err);
            } else {
                console.log('Messages sent');
                resolve();
            }
        }
);
});
facebook-graph-api facebook-javascript-sdk facebook-messenger facebook-messenger-bot facebook-messages
1个回答
1
投票

看起来已经有一个当前的错误报告 - https://developers.facebook.com/support/bugs/260229951577494/

订阅,在该错误报告的状态发生变化时进行更新。

© www.soinside.com 2019 - 2024. All rights reserved.