genkovich / DialogFlowBotManMiddleware

Middleware for BotMan (BotMan Studio). Integration with DialogFlow API v2.
MIT License
12 stars 3 forks source link

BotMan DialogFlow Middleware

BotMan Middleware to connect DialogFlow with BotMan

Latest Version on Packagist [Packagist]()

Thank's to @eclips16. The code source was taken from pull request.

Installation

Composer

composer require genkovich/dialog-flow-bot-man-middleware

Usage

.env

GOOGLE_CLOUD_PROJECT=project-id
GOOGLE_APPLICATION_CREDENTIALS=/path/to/security-file.json

Where can I get this variables?

Step one

Step

Step

Step

Step

Step

Code example

$dialogflow = \BotMan\Middleware\DialogFlow\V2\DialogFlow::create('en');
$botman->middleware->received($dialogflow);
$botman->hears('smalltalk.(.*)', function ($bot) {
    $extras = $bot->getMessage()->getExtras();
    $bot->reply($extras['apiReply']);
})->middleware($dialogflow);

smalltalk.(.*) - there is action name pattern Step

If you create actions with different prefixes, you can use ->ignoreIntentPattern()

$dialogflow = DialogFlow::create('en')->ignoreIntentPattern();

Security Vulnerabilities

If you discover a security vulnerability within BotMan, please send an e-mail to Marcel Pociot at m.pociot@gmail.com. All security vulnerabilities will be promptly addressed.

License

BotMan is free software distributed under the terms of the MIT license.