Created
June 13, 2018 18:44
-
-
Save MarGul/00e6ea6d158b4dafcd7147bc638284bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use App\Http\Controllers\BotManController; | |
use BotMan\BotMan\Middleware\ApiAi; | |
$botman = resolve('botman'); | |
$dialogflow = ApiAi::create('the-developer-token-at-dialog-flow')->listenForAction(); | |
// Apply global "received" middleware | |
$botman->middleware->received($dialogflow); | |
// Apply matching middleware per hears command | |
$botman->hears('find_restaurant', function (BotMan $bot) { | |
// The incoming message matched the "my_api_action" on Dialogflow | |
// Retrieve Dialogflow information: | |
$extras = $bot->getMessage()->getExtras(); | |
$apiReply = $extras['apiReply']; | |
$apiAction = $extras['apiAction']; | |
$apiIntent = $extras['apiIntent']; | |
$bot->reply("this is my reply"); | |
})->middleware($dialogflow); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment