prequeties:
- had bot telegram with key access_token
- downloaded ngrok
- using python 3.9 (you can have 2 python version in laptop)
- for simply dev with venv just using PyCharm
pycharm
setup new project, just call rasa-chat-bot
in ~/workspace/rasa-chat-bot
.
using venv
with python 3.9
. create project.
setup rasa
just simply setup rasa default for test. in pycharm open tab terminal,
# create new folder
$ mkdir RasaDefault && cd RasaDefault
# fast setup new rasa
$ rasa init --no-prompt
# let it, lets change another file
get ngrok url
exec ngork with command
./ngrok http 5005
example you get url https://e33d-101-128-117-173.ngrok-free.app
. copy ngrok url
add config telegram to rasa
open file credentials.yml
, you can clear the rest and just fill
rest:
telegram:
access_token: "396175282:AAHXVRsnEDWYs9gjI6b7ao0GIXyTgLFEqv8"
verify: "your_name_bot"
webhook_url: "https://e33d-101-128-117-173.ngrok-free.app/webhooks/telegram/webhook"
rasa:
url: "http://localhost:5002/api"
setup webhook telegram
open browser paste url, or via curl
https://api.telegram.org/bot396175282:AAHXVRsnEDWYs9gjI6b7ao0GIXyTgLFEqv8/setWebhook?url=https://e33d-101-128-117-173.ngrok-free.app/webhooks/telegram/webhook
wait json respond
restart rasa
back to terminal, shutdown rasa shell with message /stop
.
then start rasa server with command
rasa run --enable-api --cors "*"