In this example we are building a simple Viber chatbot using DialogFlow and Node.js. The final chatbot will generate nutrition responses for users based on the inputs they provide. The bot uses the data.gov nutrition facts API as its source.
See the developer guide at developers.viber.com for more details.
-
Create a new agent in DialogFlow.
-
Click on the project gear icon () to see the project settings.
-
Select "Export and Import".
-
Select "Restore from zip". Follow the directions to restore.
-
Select the
ViberSampleAgent.zip
file in this repository. -
[Optional] Set your Data.gov API key in the environment variable:
- Copy the sample environment variable
cp .env.sample .env
. - Edit
.env
with your Data.gov API key.
- Copy the sample environment variable
-
Deploy this app to your preferred hosting environment.
-
Set the "Fulfillment" webhook URL to the deployment url. For instance on Heroku it will look like this
https://[App Name].herokuapp.com/hook
. -
Enable Viber in the DialogFlow "Integrations" panel.
-
For both
meal.info
andnutrition.info
intents check both "Use webhook" and "Use webhook for slot-filling" in the "Fulfillment" section, and save the intent.
If you find any issues with this sample, please open a bug here on GitHub.
Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Viber API Terms of Service.