添加get_started和persistent_menu Messenger Webhook后没有响应

时间:2019-05-22 06:20:38

标签: facebook-messenger facebook-messenger-bot

在添加Messenger“ get_started”按钮和“ persistent_menu”之前,一切都还不错。当我添加这些功能时,facebook返回“ {result:'success'}”。之后,我的Messenger Webhook没有响应。我已经一个又一个地添加了。我的两个facebook应用在同一事件后都显示相同的问题。

我该如何解决?

function getStartedButton() {
    request({
        url: 'https://graph.facebook.com/v2.6/me/messenger_profile',
        qs: { access_token: process.env.MESSENGER_ACCESS_TOKEN },
        method: 'POST',
        json: {
            "get_started": {
                "payload": "get_started_initiated"
            }
        }
    }, function (error, response, body) { console.log('getStartedButton:', body) })
    return this;
};

function persistentMenu() {
    request({
        url: 'https://graph.facebook.com/v2.6/me/messenger_profile',
        qs: { access_token: process.env.MESSENGER_ACCESS_TOKEN },
        method: 'POST',
        json: {
            "persistent_menu": [
                {
                    "locale": "default",
                    "composer_input_disabled": false,
                    "call_to_actions": [
                        {
                            "title": "Recent",
                            "type": "nested",
                            "call_to_actions": [
                                {
                                    "title": "Editorials/Opinions",
                                    "type": "postback",
                                    "payload": "editorial.recent.full$$$1",
                                }
                            ]
                        },
                        {
                            "title": "Details",
                            "type": "nested",
                            "call_to_actions": [
                                {
                                    "title": "Editorials/Opinions",
                                    "type": "postback",
                                    "payload": "editorial.recent.full",
                                }
                            ]
                        },
                        {
                            "title": "More...",
                            "type": "nested",
                            "call_to_actions": [
                                {
                                    "title": "English News Recent",
                                    "type": "postback",
                                    "payload": "google.news.english.full$$$1",
                                },
                                {
                                    "title": "English News",
                                    "type": "postback",
                                    "payload": "google.news.english.full",
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }, function (error, response, body) { console.log('persistentMenu:', body) })
    return this;
}

0 个答案:

没有答案