- Node.Js >= 6.0
- MongoDB (URL connection string in environment variable MONGO, example:
export MONGO="mongodb://username:password@host1:27017/ovhchatbot"
) - Facebook developer account with Facebook developer app created (more explanations below)
- Slack developer account with Slack developer app created (more explanations below)
- Api.ai account
- OVH account
- Public ip with domain linked in HTTPS
For each environment variable, if you want to use docker and docker-compose you can put the value in the Dockerfile
of this project.
- Create an account on api.ai website and create a new agent
- Go in settings of your agent in tab Export and Import
- Click on restore from zip and import the zip that are in the
archives
directory of this project. - Go in settings, copy/paste Client access token and save it into the env variable named
APIAI_TOKEN
- You have to host this project on a public instance with a public ip and link this IP to a domain name
- To get a free SSL on your domain linked to the public ip of your chatbot API you can use the "SSL Gateway" service by OVH or simply use Let's encrypt. You just have to indicate the domain and ip linked to this domain.
- Save your domain name into env variable APP_URL (for example:
export APP_URL=https://myCustomDomain.com
)
Without docker
$ npm i
$ APP_PORT=80 npm start
With docker and docker-compose
$ sudo docker-compose up
-
On your server export an env variable named
FB_VALIDATION_TOKEN
with the valueovh_chatbot_dev
for example. This value is the same that you fill in step 2 of this Facebook tutorial and the webhook url must behttps://yourCustomDomain/api/v1.0/webhook
-
Follow the four first steps described here, but don't take care about the sample app that Facebook give.
-
Save the correspondant informations in env variable (
FB_APP_SECRET
--> in sectiondashboard
,FB_APP_ACCESS_TOKEN
--> in sectionmessenger
) -
(Optional) you can add a welcome text:
$ curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"greeting",
"greeting":{
"text":"Your welcome text here"
}
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=$FB_APP_ACCESS_TOKEN"
- Go on this page and create a new app
- Enable Interactive Messages and add request URL
https://yourCustomDomain/api/v1.0/slack/actions
- Enable Event Subscriptions and add request URL
https://yourCustomDomain/api/v1.0/slack
- In the same section subscribe to event message.im and save changes
- Add a bot user in section Bot Users
- In section OAuth & Permissions add permissions named
bot
andchat:write:bot
- In the same section click on Install App to Team in order to get the Bot User Oauth Access Token which are saved in our env variable as
SLACK_BOT_ACCESS_TOKEN
- Then add a redirect URLs like this one
https://yourCustomDomain/api/v1.0/slack/authorize
- In section Basic Information you can fetch the Client ID saved in our env variable as
SLACK_ID
, the Client Secret saved inSLACK_SECRET
and the Verification Token inSLACK_TOKEN
- Go in Manage Distribution section and access to the Sharable URL to install slack bot into your team.
- Go on this page and click on First steps with the OVH API to create an application and save the application key and secret in env variable
OVH_KEY
andOVH_SECRET
- For the api.ai agent translation: Have a look at tools
- For the bot translation: Have a look at translations
APIAI_TOKEN
APP_PORT (optional, default is 8080)
APP_URL
FB_APP_ACCESS_TOKEN
FB_APP_SECRET
FB_VALIDATION_TOKEN
OVH_BASE_PATH
OVH_KEY
OVH_SECRET
MONGO (optional, default is `mongodb://mongo:27017`)
SLACK_BOT_ACCESS_TOKEN
SLACK_ID
SLACK_SECRET
SLACK_TOKEN
If you need more informations you can join us on Gitter