简体   繁体   中英

Webhook messenger FB API

I am trying to activate the receipt of facebook messages on my webhook, but according to the facebook documentation there is no longer an option.. for example, in the print below I am looking for the "messages" permission but it does not exist anymore...

在此处输入图像描述

Currently I installed the messenger component in my application, however I realized that if I go manually and activate the receipt of the pages it works, however as I said "manual", I would like to automate this via the option of "subscriptions". 在此处输入图像描述

I added in my code the sending of the "messages" field, however it also has no effect...

 $facebook = new Facebook();
            $facebook->setDefaultAccessToken($page['access_token']);
            //?subscribed_fields=leadgen
            $response = $facebook->post(
                '/' . $page['id'] . '/subscribed_apps',
                [
                    'subscribed_fields' => [
                        'leadgen',
                        'feed',
                        'messages',
                    ],
                ],
                $page['access_token']
            );

If you want to do this in the UI you have to do it in the Messenger products settings, not Webhook settings(your first screenshot).

This guide explains how to do it: https://developers.facebook.com/docs/messenger-platform/getting-started/app-setup#setting-up-your-facebook-app

https://developers.facebook.com/apps/ <app_id>/messenger/settings

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM