A hubot script that adds conversational user experience with dialogflow as back-end.
When you talk to Hubot, this script sends the text to dialogflow, which in turns handles the dialog and detects intents and parameters. Finally, the script emits an event (robot.emit) so that it can be consumed by other scripts.
See src/dialogflow.coffee
for full documentation.
Clone or copy the dialogflow.coffee into your bot script folder.
install dialogflow
yarn add dialogflow
or
npm install dialogflow --save
DIALOGFLOW_PROJECT_ID
: dialogflow project id which you get from https://console.dialogflow.com/api-client/
GOOGLE_APPLICATION_CREDENTIALS
: path to the google sevice account key json file
hubot-dialogflow will emit events which correspond to intents that you describe in API.AI.
Let's say that you have an intent called help-me
in dialogflow. You can create
an hubot script which will act on help-me
intents:
module.exports = (robot) ->
robot.on "help-me", (msg, params) ->
# Your code here
The parameters from the intent are passed as part of Hubot's event.
- Add tests
- put this to NPM