I'm using Botman 2.0 and Codeigniter 3.1.6
My owner server with HTTPS & FB Webhook setup successfully.
How do I have to setup my project with codeigniter? Because, I set the FB Webhook setup successfully, but, when I type "hi" on messenger this not reply.
Could you give me some advice for that my chat bot works correctly.
Note 1: I had test with PHP (Without framework) and This works correctly.
Note 2: I had test with NodeJS and This works correctly.
use BotMan\BotMan\BotMan;
use BotMan\BotMan\BotManFactory;
use BotMan\BotMan\Drivers\DriverManager;
class Facebook_messenger extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function bot(){
$config = [
// Your driver-specific configuration
'facebook' => [
'token' => 'EAAZA1UK2sl8UBAIueLY2ZCHraasS3E52AS37wUVypMLQatW5taE71LByyl3nWNau8uTKYs1aw11lQXpDOfPrrQE8BLWf6PZBkwuQIdzea7lMeZCc4jCiZCqhKZABKnc2V8FNabVbHF9J6opkb6MCsBAxnqO0kDsgeoYV88gNOIJuTZAr9T7pzoBAZC',
//'app_secret' => 'f1a032fb00484a59c0322617b7623745a',
'verification'=>'xxxxapp',
]
];
// Load the driver(s) you want to use
DriverManager::loadDriver(\BotMan\Drivers\Facebook\FacebookDriver::class);
// Create an instance
$botman = BotManFactory::create($config);
// Give the bot something to listen for.
$botman->hears('hi', function (BotMan $bot) {
$bot->reply('Hello');
});
$botman->hears('delayed', function (BotMan $bot) {
$bot->reply('Field will remain in yellow (delayed)unless a game is scheduled on it.');
});
$botman->hears('canceled', function (BotMan $bot) {
$bot->reply('Games cancelled due to poor field conditions.');
});
// Start listening
$botman->listen();
}
}