1. Go to this page and download the library: Download torgodly/messenger-bot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use MessengerBot\Facades\MessengerOAuth;
return MessengerOAuth::redirectToFacebook($pageModel);
use MessengerBot\OAuth\CompleteOAuthPageLink;
use MessengerBot\OAuth\PendingOAuthPages;
$payload = PendingOAuthPages::pull($request->query('token'));
// $payload['pages'], $payload['mt']
app(CompleteOAuthPageLink::class)->complete($chosenPage, $payload['mt']);
use MessengerBot\Contracts\ValidatesMessengerPageLink;
final class YourPageLinkValidator implements ValidatesMessengerPageLink
{
public function assertMayLinkPage(array $page, array $mt): void
{
// Block if page_id belongs to another tenant
// Block if tenant already has a different page_id
// Allow reconnect when page_id unchanged
}
}