Reading this https://developers.facebook.com/docs/messenger-platform/discovery/facebook-chat-plugin/ manual
I created Facebook Page and inserted Messenger Chat Plugin Code into my Laravel 9 page,
So I can send and recieve messages in chat bot on facebook page and on page of my site.
Next I want to send message from laravel app to user in some case, say user has some event we want to notify him about.
I read this example with code :
Send a POST request to the /PAGE-ID/chat_plugin endpoint to customize
the welcome screen greeting, color, icon, and more, for your plugin.
Example Request curl -i -X POST
"https://graph.facebook.com/v14.0/PAGE-ID/chat_plugin
?welcome_screen_greeting:YOUR-WELCOME-TEXT
&theme_color:553399
&entry_point_icon:MESSENGER_ICON
&entry_point_label:CHAT
and I make in my control action:
$messageData = [
"welcome_screen_greeting"=> "welcome to my app",
"theme_color"=> "553399",
"messaging_type"=> "welcome_screen_greeting",
"entry_point_icon"=> "MESSENGER_ICON",
"entry_point_label"=> "CHAT", // ?
"recipient" => [
"user_ref" => 'NNNNNN', // That is id of my profile https://www.facebook.com/profile.php?id=NNNNNN
],
"message" => [
"text" => "hello, world from the app!",
],
];
$ch = curl_init('https://graph.facebook.com/v14.0/PAGE-ID/chat_plugin?access_token=' . config('app.PAGE_ACCESS_TOKEN'));
\Log::info( varDump($ch, ' -1 BotController sendTextMessage $ch::') );
as result on my screen I see :
{"success":true}
I am not sure of which command this output is ?
var $ch in log has empty(false) value.
I have valid app.PAGE_ACCESS_TOKEN param in .env file.
If I hide one of parameters in $messageData I - got error.
But I do not have any chat bot notification in my facebook...
What is wrong ?
Thanks!