Design of an extensible chatbots cloud architecture for its application to the improvement of the consumption and the exploitation of public services and data.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
This project is fully Dockerized and orchestrated with Docker Compose, is mandatory to have previously installed both.
Create your version of src/bilbot-php/www/Constants.php.dist
without the .dist
extension and your API keys.
Build the images:
docker-compose build
Run the services:
docker-compose up -d
Prepare the environment:
-
Log in to the
watson-php
container by running the following command:docker exec -it bilbotpfm_watson-php_1 bash
-
Install dependencies by running the following command:
cd /var/www/docker-symfony && composer install -n
-
Change
/tmp
dir permissions:chown -R www-data:www-data /tmp
Do the same process with welive-php
container.
Open Telegram and search the bot @bilb0_bot
to start a conversation.
You can ask to the bot information using the following commands:
/saludo
for a greeting message./agenda
for information about events./bicis
for information about bike rental service./asociaciones
for information about clubs./hoteles
for information about accomodation./restaurantes
for information about restaurants./atracciones
for information about tourist attractions./turismo
for information about tourist offices.
Get fun with it asking information!
Add the following line to your /etc/hosts
file:
127.0.0.1 bilbot.dev
Add the following line to your %SystemRoot%\System32\drivers\etc\hosts
file:
127.0.0.1 bilbot.dev
The web server is constantly querying the Telegram API for new messages sent to Bilbot, for stopping the containers:
docker-compose down
To remove the built image and starting from scratch:
docker-compose down
docker-compose rm
All the received messages are stored in a MySQL Database which can be accessed in localhost.
Name | Address | Description |
---|---|---|
bilbot | bilbot.dev:80 | Contains the Telegram bot API logic and the user commands. |
bilbot-watson | bilbot.dev:81 | Contains the Watson API querying logic and is based on Symfony. Contains a testing index page. |
bilbot-welive | bilbot.dev:82 | Contains the WeLive API querying logic and is based on Symfony. Contains a testing index page. |
The deployment process is based on a Bash script, which compress the source folders in a tar and upload them to a VPS.
For deploying a new version in your VPS, just add your SSH keys to your keychain, change the VPS address in deploy.sh
and execute:
./deploy.sh
If you want to stop the bot instance in your VPS, change the VPS address of the file stop_vps.sh
and execute it with
./stop_vps.sh
- Create a new Controller with all the needed queries to the dataset inside of
src/bilbot-welive/src/AppBundle/Controller/REST
- Create at least 3 types of queries
listAction
,detailAction
andsearchAction
for making easier the interaction with the bot
- Create at least 3 types of queries
- Add the routing for the actions inside of
src/bilbot-welive/src/AppBundle/Resources/config/routing_api.yml
following the naming convention{dataType}_{action_name}
- Create a new command file in
src/bilbot-php/www/Commands
with the name{CommandNameCommand.php}
is highly recommended to duplicate an existing one and changing the name of the class within - Change the class properties
$name
,$description
,$usage
and the constantsWELIVE_SEARCH_METHOD
,WELIVE_LIST_METHOD
andDATA_PREFIX
, please note that these are the route slugs created in step 2.DATA_PREFIX
is recommended to be one word with a trailing underscore (_) should be descriptive of the type of data, this will be used by theCallbackqueryCommand.php
for handling the origin of the callbacks. - Customize the button text representation in
search
function call parameters and the data column to be represented as title. - Add the data prefix without the trailing underscore to the
$entities
associative array inCallbackqueryCommand.php
with the subkeysaction
to represent the detail route slug created in step 2 andcolumn
for the column that will be used as primary key for the search, it must be consistent with the argument that will receive the detail action in the controller. - Add a new switch clause in the function
buildAnswer
using the data prefix without trailing underscore with the text that will be rendered as answer to the user. - Add the new file command path to
src/bilbot-php/www/init.php
- Restart docker containers with
docker-compose down && docker-compose up
- Text BotFather in Telegram to update the user visible command list
- PHP Telegram Bot - A Telegram bot framework in PHP
- Telegram - Telegram Instant Messaging platform.
- IBM Watson - AI engine
- WeLive - Datasets sources
- Symfony - Web Framework
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Aitor Brazaola - Main developer - GitHub
This project is licensed under the GPL v3 License - see the LICENSE.md file for details
- docker-symfony - Szymon Skórczyński
- Example Bot Telegram - PHP Telegram Bot Developers
- Coffe & Daft Punk