Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

PHP library for Facebook Messenger bot development. Provides webhook handling, message templates, conversation flows, user profiles, NLP integration, persistent menus, and quick replies with a lightweight implementation.

License

Notifications You must be signed in to change notification settings

aashari/example-php-facebook-messenger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Facebook Messenger

This is a very simple PHP class for Facebook Messenger Bot, you can send and receive message through this simple PHP class


Documentation

constructor

The constuctor have 2 required parameter and 1 optional parameter, which is:

Parameter Description
$access_token Your page access token
$verify_token Your private verify token
[$request] request method by default will be filled with _REQUEST global parameter

listen

This method will listen request from Messenger Webhook, this is will return null or array.

Return Description
null There's no request from Messenger Webhook
array Array data (payload) received from Messenger Webhook

Note: This method is required to verify your Webhook Callback too, it will return a single string called hub challenge for Webhook Callback verification process.

Array data (payload) received froom Messenger Webhook can means many things such as message received or message read, you can see the complete documentation here:

https://developers.facebook.com/docs/messenger-platform/webhook-reference

sendMessage

This method can send a message to specific user, there's 2 parameter for this method, which is, recipientId (string) and message (array), here is example of sendMessage method:

$message = array( 'text' => 'Hello World!' ); $response = $fbMessenger->sendMessage('1234567890',$message); 

above code snippets will send a very simple text message to user messenger with id 1234567890, there's a lot of message format message to send, you can see the complete documentation here:

https://developers.facebook.com/docs/messenger-platform/send-api-reference

the method will return a response of request, you can see the complete documentation here:

https://developers.facebook.com/docs/messenger-platform/send-api-reference#response

if you have any question, feel free to contact me through this website https://www.aashari.id/, thanks

About

PHP library for Facebook Messenger bot development. Provides webhook handling, message templates, conversation flows, user profiles, NLP integration, persistent menus, and quick replies with a lightweight implementation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages