https://github.com/dialogflow/dialogflow-botkit-client
Botkit library for Dialogflow
https://github.com/dialogflow/dialogflow-botkit-client
Last synced: 2 months ago
JSON representation
Botkit library for Dialogflow
- Host: GitHub
- URL: https://github.com/dialogflow/dialogflow-botkit-client
- Owner: dialogflow
- License: apache-2.0
- Created: 2016-03-29T22:28:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-20T18:48:58.000Z (over 6 years ago)
- Last Synced: 2024-10-01T14:46:44.497Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 62
- Watchers: 11
- Forks: 39
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# DEPRECATED api-ai-botkit
| Deprecated |
|-------|
| This Dialogflow client library and Dialogflow API V1 [have been deprecated and will be shut down on October 23th, 2019](https://blog.dialogflow.com/post/migrate-to-dialogflow-api-v2/). Please migrate to Dialogflow API V2 and the [v2 client library](https://cloud.google.com/dialogflow-enterprise/docs/reference/libraries/nodejs) |[](https://www.npmjs.com/package/api-ai-botkit)
Utility lib for creating bots. So far only tested with Slack.
For usage sample code see `examples/sample_bot.js`
## Steps for using lib
Install library from npm
```sh
npm install --save api-ai-botkit
```Import Library
```js
const apiaibotkit = require('api-ai-botkit');
```Create `apiai` object using token from http://api.ai website
```js
const apiai = apiaibotkit(apiaiToken);
```Use `apiai` object in `controller.hears`
```js
controller.hears('.*', ['direct_message', 'direct_mention', 'mention'], function (bot, message) {
apiai.process(message, bot);
});
```Implement different reactions to appropriate actions
```js
apiai
.action('smalltalk.greetings', function (message, resp, bot) {
var responseText = resp.result.fulfillment.speech;
bot.reply(message, responseText);
})
.action('input.unknown', function (message, resp, bot) {
bot.reply(message, "Sorry, I don't understand");
});
```
## License
See [LICENSE](LICENSE).## Terms
Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/).This is not an official Google product.