Skip to content
Permalink
Browse files

Add api.ai web hook, fallback handler

No real action handlers yet; they'll be in the next commit!
  • Loading branch information...
iansltx committed Nov 13, 2017
1 parent 8abb127 commit 78f1f79d3baee88f38f57df8881761ae0172d607
Showing with 17 additions and 4 deletions.
  1. +3 −1 README.md
  2. +2 −0 bootstrap/routes.php
  3. +9 −1 bootstrap/services.php
  4. +3 −2 composer.json
@@ -15,7 +15,9 @@ Usage
-----

Run using one of the below methods, then visit `http://localhost:9000/bot` to view
the bot page.
the bot page. Use a tool like [ngrok](https://ngrok.com) to make your application
available to the outside world, then set `https://your-hostname-here.ngrok.io/hook`
as the destination of your api.ai agent web hook.

### Run with Docker

@@ -8,4 +8,6 @@
str_replace('{{ API_AI_KEY }}', getenv('API_AI_KEY'), file_get_contents(__DIR__ . '/../templates/bot.html')
));
});
$this->post('hook', \iansltx\DialogflowBridge\Middleware\DoublePass::class);
};
@@ -1,5 +1,13 @@
<?php
use iansltx\DialogflowBridge\{Question, Answer, Middleware\DoublePass, Router};
return function(\Pimple\Container $c, $env) {
// services will go here
$c[DoublePass::class] = function() {
return new DoublePass(Router::buildFromClosureArray([
// no skills yet
], function(Question $question, Answer $answer) : Answer {
return $answer->withSpeechAndText("Sorry, I don't know how to help you with that.");
}));
};
};
@@ -1,7 +1,7 @@
{
"name": "iansltx/build-a-bot",
"description": "Build a Bot workshop companion code",
"keywords": ["PNWPHP", "conference", "php-world", "bot", "api.ai", "web hook"],
"keywords": ["PNWPHP", "conference", "php-world", "bot", "api.ai", "dialogflow", "web hook"],
"homepage": "https://github.com/iansltx/build-a-bot",
"license": "MIT",
"authors": [
@@ -14,7 +14,8 @@
],
"require": {
"php": "^7.1",
"slim/slim": "^3.8.1"
"slim/slim": "^3.8.1",
"iansltx/dialogflow-bridge": "^0.3"
},
"autoload": {
"psr-4": {"BuildABot\\App\\": "src/"}

0 comments on commit 78f1f79

Please sign in to comment.
You can’t perform that action at this time.