PHP code example of samiaraboglu / fb-messenger-api-bundle
1. Go to this page and download the library: Download samiaraboglu/fb-messenger-api-bundle 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/ */
samiaraboglu / fb-messenger-api-bundle example snippets
return [
// ...
Samiax\FbMessengerApiBundle\FbMessengerApiBundle::class => ['all' => true],
// ...
];
namespace App\Controller\Messenger;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
use Samiax\FbMessengerApiBundle\Service\MessengerApi;
/**
* Messenger Controller
*
* @Route("/messenger", name="app_messenger_")
*/
class MessengerController extends AbstractController
{
/**
* @Route("/send", name="send")
*
* @return Response
*/
public function sendAction(MessengerApi $messengerApi)
{
$messenger = $messengerApi->messenger;
$message = $messenger->message;
$message->text('<MESSAGE_TEXT>');
$messenger->send(<PSID>, $message);
return new Response();
}
}