после добавления get_started & persistent_menu мессенджер не отвечает - PullRequest
0 голосов
/ 22 мая 2019

Все было хорошо, прежде чем я добавил мессенджер "get_started" и кнопку "persistent_menu". Когда я добавил эти функции, Facebook вернул "{result: 'success'}". После этого мой мессенджер не отвечает. Я добавил оба по порядку. Мои два приложения на 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;
}
...