PHP Classes

How to Interact with Facebook Users Using a Basic PHP Facebook Messenger Bot: Exchange messages with Facebook Messenger users

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 80 All time: 10,097 This week: 129Up
Version License PHP version Categories
basic-facebook-bot 1.0The PHP License5PHP 5, Chat, Social Networking


This class can exchange messages with Facebook Messenger users.

It can process the contents of a message received by a Facebook Messenger bot script and returns the message sender's Facebook user identifier and the message text.

The class can also send a message to a Facebook user via Facebook Messenger.

Picture of uche
Name: uche <contact>
Classes: 9 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 279319 in Nigeria Nigeria
Week rank: 72 Up5 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 7x


/*Created by MmuoDev.
require_once 'classes/botClass.php';

if (isset(
$_GET['hub_verify_token'])) {
    if (
$_GET['hub_verify_token'] === VERIFY_TOKEN) { //Token entered during setup. It is defined as a constant in constants.php
echo $_GET['hub_challenge'];
    } else {
'Invalid Verify Token';
$accessToken = ACCESS_TOKEN; //Access token generated by Facebook. It is defined as a constant in constants.php.
$bot = new botClass(); //Initialize an object of the bot class
$input = json_decode(file_get_contents('php://input'), true); //JSON decode messages received
$message = $bot->readMessage($input); //Call the method that reads messages
$bot->sendMessage($message); //Call the method that sends messages

  Files folder image Files  
File Role Description
Files folder image.idea (1 file)
Files folder imageclasses (2 files)
Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  .idea  
File Role Description
  Accessible without login Plain text file workspace.xml Data Auxiliary data

  Files folder image Files  /  classes  
File Role Description
  Plain text file botClass.php Class Class source
  Accessible without login Plain text file constants.php Conf. Auxiliary script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,097
This week:129Up