We heard about Sonar last year on Andrew Turner presentation and we though that we could build a bot that could be setup to work within an organization, so any Esri Customer could launch it own bot easily (more about this project).
Table of Contents
- Telegram Account
- dialogFlow bot. (If you want to build your own Bot)
Bot versions:
- Telegram (Recommended)
- If you don't have a Telegram Account, create one
- If you already have a Telegram Account you can start to talk to GISTalkBot
- HTML5 (under construction)
The HTML5 doesn't support multiple messages, enriched text (so links won't be clickable), etc.
You can also see how it works on this video presentation:
By default this bot is able to help users to:
- Search items | Sample sentences:
- have you published anything about
Web AppBuilder
- I'm looking for
PDF
files - I want
Image Service
items - which
basemaps
have you published? - give me some
CSV
fromgeogeeks
(search within geogeeks.maps.arcgis.com)
- have you published anything about
- See attachments from a feature service | Sample sentence:
- I would like to see the attachments from https://services.arcgis.com/0ZRg6WRC7mxSLyKX/arcgis/rest/services/harveyDamagePhotos/FeatureServer/0
Note: you can ask for any keyword or any other custom term.
Steps:
-
Create a dialogFlow agent . For importing all configuration, you can find bot backups here
-
Create your own Telegram bot (using the Telegram @BotFather)
-
Take note of the API_TOKEN of your brand new bot. You'll need it on the next step.
-
Configure Telegram integration on dialogFlow. Watch this video PENDING
-
Install on your computer our Telegram Webhook . Follow this video instructions
-
Test Locally
For the sake of speed , please install ngrok in your computer. ngrok let's your machine be Internet reachable thru a tunneled connection , just with one command :
ngrok http 3000
This command outputs something like:
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account --------- ---- --- (Plan: Free)
Version 2.2.8
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://e117e6ea.ngrok.io -> localhost:3000
Forwarding https://e117e6ea.ngrok.io -> localhost:3000
Connections ttl opn rt1 rt5 p50 p90
1 0 0.00 0.00 5.04 5.04
You can also log, replay & check the status of all connections in http://localhost:4040
TIP Once you've downloaded it , unzip it , and move ngrok to /usr/local/bin folder , letting you run this command from anywhere
-
Enable fullfillment on fullfillment session in dialogflow in your agent.
-
Fill in URL. Taking the ngrok setup above as an example , the URL field would be:
https://e117e6ea.ngrok.io/ask
Notice that we append /ask at the end of the URL, and use the https url.
- Test it!
Open your telegram chat url in a Browser and start a conversation!!
- If the bot doesn't answer , review your setup , and check twice that dialogflow intents has fullfillment option check (web-hook)
You can use now.sh. You can create an account for free!
Once you have created your now.sh account , Download Now Desktop.
When you have installed Now Desktop , open a terminal and go to the folder where you cloned this repo.
At this point , type the following
cd bot_webhook/
now -e BOT_MODE="prod" -e BOT_SECRET="comeon" -e BOT_HEADER="esri-chat"
You will see a similar output like the following:
Machineitor in ~/esri/hackathon/gis-talk-bot/bot_webhook
± |master U:1 ✗| → now -e BOT_MODE="prod" -e BOT_SECRET="comeon" -e BOT_HEADER="esri-chat"
> Deploying ~/esri/hackathon/gis-talk-bot/bot_webhook under <YOUR_MAIL>
> Using Node.js 8.9.4 (default)
> Ready! https://gis-talk-bot-v2-dmqsafdomn.now.sh (copied to clipboard) [4s]
> You (<YOUR_MAIL>) are on the OSS plan. Your code and logs will be made public.
> NOTE: You can use `now --public` to skip this prompt
> Synced 1 file (1.55KB) [8s]
> Initializing…
Update URL in FullFillment section of dialogFlow. The URL in this example would be :
https://gis-talk-bot-v2-dmqsafdomn.now.sh/ask
Et voila!