Closed rauldpm closed 1 year ago
A first approximation has been made using ngrok, which allows obtaining a public address and linking the rasa server with telegram, for this, I have followed the following steps:
At the same time, it is necessary to start the rasa and actions server:
In this way rasa receives and sends messages in JSON format, locally, the following can be executed:
curl -XPOST http://localhost:5005/webhooks/rest/webhook -H "Content-type: application/json" -d '{"sender": "test", "message": "Horario"}'
Having the answer:
[{"recipient_id":"test","text":"Nuestro horario es:"},{"recipient_id":"test","text":"Lunes: 08:00 - 22:00.\nMartes: Cerrado.\nMiercoles: 08:00 - 22:00.\nJueves: 08:00 - 22:00.\nViernes: 08:00 - 22:00.\nSabado: 08:00 - 22:00.\nDomingo: 08:00 - 22:00."}]%
When runing ngrok you get an output like the following:
ngrok (Ctrl+C to quit)
Phishing is against the TOS. Don't do it.
Session Status online
Account (My name) (Plan: Free)
Version 3.0.6
Region Europe (eu)
Latency -
Web Interface http://127.0.0.1:4040
Forwarding https://8bd6-188-78-170-15.eu.ngrok.io -> http://localhost:5005
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
Where https://8bd6-188-78-170-15.eu.ngrok.io
is the public address to set in the credentials file
When creating the bot using BotFather in Telegram, you need to set a name for the bot and an identifier:
Then we are provided with a TOKEN that must be entered in the credentials.yml file as follows
telegram:
access_token: "{BOT_TOKEN}"
verify: "restaurante_rauldpm_bot"
webhook_url: "https://{NGROK_URL}/webhooks/telegram/webhook"
Once everything is configured, you can access an ngrok interface where the requests made are reported:
This option is used to test on Telegram, since it does not cost money and has a limited number of requests, but it does not serve to carry out a definitive deployment in production due to the limitation of requests and availability
Heroku provides up to 5 deployments for free but with limited hardware https://www.heroku.com/pricing
The free plan provides:
The standard plan provides from 512MB to 14GB with a fixed price range from $25 to $500.
Due to the little flexibility that this platform has (the bot will increase its requirements as more stories are learned with the users), the deployment in Google Cloud and AWS ECS will be studied.
aws configure
aws ecr get-login-password | docker login --username AWS --password-stdin {created repo_url}
docker build -t rasa-server .
docker build -t rasa-actions .
docker tag rasa-actions:latest {repo_url}/tfg:rasa-server
docker tag rasa-actions:latest {repo_url}/tfg:rasa-actions
docker push {repo_url}/tfg:rasa-server
docker push {repo_url}/tfg:rasa-actions
This option allows for extensive customization of the environment through the use of EC2, ECS, CloudFormation, IAM, and others.
An infrastructure can be made consisting of:
This issue aims to manually deploy the bot on a platform of your choice and enable the use of the bot on Telegram.