Facebook messenger奇怪的错误

时间:2017-01-22 04:36:58

标签: facebook facebook-messenger messenger facebook-messenger-bot

我正在尝试快速回复facebook messenger - 我在下面收到此错误:

2017-01-22T04:18:40.538348+00:00 app[web.1]: Error:  { message: '(#100) Invalid keys "message" were found in param "message".',
2017-01-22T04:18:40.538359+00:00 app[web.1]:   type: 'OAuthException',
2017-01-22T04:18:40.538361+00:00 app[web.1]:   code: 100,
2017-01-22T04:18:40.538361+00:00 app[web.1]:   fbtrace_id: 'F9umRNKYj+/' }
2017-01-22T04:18:40.907028+00:00 app[web.1]: Error:  { message: '(#100) Invalid keys "message" were found in param "message".',
2017-01-22T04:18:40.907040+00:00 app[web.1]:   type: 'OAuthException',

这是我在下面使用的代码 - 我从他们的开发者网站上提取的示例facebook代码。

function startUpMenu(sender) {
            let messageData = {
                "message":{
                   "text":"Pick a color:",
                   "quick_replies":[{
                       "content_type":"text",
                       "title":"Red",
                       "payload":"RedText"
                      },
                      {
                        "content_type":"text",
                        "title":"Green",
                        "payload":"GreenText"
                      }]
                }               
            }
            request({
                url: 'https://graph.facebook.com/v2.6/me/messages',
                qs: {access_token:token},
                method: 'POST',
                json: {
                    recipient: {id:sender},
                    message: messageData,
                }
            }, function(error, response, body) {
                if (error) {
                    console.log('Error sending messages: ', error)
                } else if (response.body.error) {
                    console.log('Error: ', response.body.error)
                }
            })
        }

有人知道如何解决这个问题吗?

2 个答案:

答案 0 :(得分:0)

我相信答案是由@WizKid提供的,可以关闭。

    public class LocatedChar
    {
        public RectangleJ Location;
        public string Text;
    }
    public class ExtendedTextChunk
    {
        public List<LocatedChar> Chars = new List<LocatedChar>();

答案 1 :(得分:0)

 function startUpMenu(sender) {
        let messageData = {
                 recipient:{
             id:sender
            },
            "message":{
               "text":"Pick a color:",
               "quick_replies":[{
                   "content_type":"text",
                   "title":"Red",
                   "payload":"RedText"
                  },
                  {
                    "content_type":"text",
                    "title":"Green",
                    "payload":"GreenText"
                  }]
            }               
        }

我希望在您的代码中进行此更改将消除错误。