Публикация поста в группу Facebook WordPress, PHP

У меня есть приложение с активированными доступами: publish_to_groups, Groups API, pages_read_engagement

и вот такой код (WordPress):

fb_publicate();
use Facebook\Exceptions\FacebookResponseException as ResponseException;
use Facebook\Exceptions\FacebookSDKException as SDKException;

function fb_publicate()
{
    $access_token = 'my_token';
    $appid = 'my_add_id';
    $appsecret = 'my_app_secret';

    $fb = new Facebook\Facebook(array(
        'app_id' => $appid,
        'app_secret' => $appsecret,
        'cookie' => true
    ));

    try {
        // Returns a `Facebook\FacebookResponse` object
        $response = $fb->post(
            '/32222233322/feed',
            array (
                'message' => 'This is a test message',
            ),
            $access_token
        );
    } catch(Facebook\Exceptions\FacebookResponseException $e) {
        echo 'Graph returned an error: ' . $e->getMessage();
        exit;
    } catch(Facebook\Exceptions\FacebookSDKException $e) {
        echo 'Facebook SDK returned an error: ' . $e->getMessage();
        exit;
    }
    $graphNode = $response->getGraphNode();
}

но при выполнении кода, все равно (даже после получения доступов) получаю такую ошибку:

Graph returned an error: (#200) If posting to a group, requires app being installed in the group, and either publish_to_groups permission with user token, or both pages_read_engagement and pages_manage_posts permission with page token; If posting to a page, requires both pages_read_engagement and pages_manage_posts as an admin with sufficient administrative permission


Ответы (1 шт):

Автор решения: Takhir Berdyiev

Код работает нормально, нужно просто было добавить приложение в группу Facebook

→ Ссылка