Wazy is a bot based on Telegram bot that allows checking travel times using Waze.
https://user-images.githubusercontent.com/4478920/200173402-8a8343c3-afc2-4341-86ea-c833bed98a9a.mp4
Before we can start working with Wazy, we need to create a new telegram bot.
How to Create a New Bot for Telegram Open Telegram messenger, sign in to your account or create a new one.
Enter @Botfather in the search tab and choose this bot (Official Telegram bots have a blue checkmark beside their name.)
Click Start to activate BotFather bot.
In response, you receive a list of commands to manage bots. Choose or type the /newbot command and send it.
Choose a name for your bot your subscribers will see it in the conversation. And choose a username for your bot the bot can be found by its username in searches. The username must be unique and end with the word bot.
After you choose a suitable name for your bot the bot is created. You will receive a message with a link to your bot t.me/<bot_username>, recommendations to set up a profile picture, description, and a list of commands to manage your new bot.
Wazy is a docker based application that can be installed using docker compose:
version: "3.6"
services:
wazy:
image: techblog/wazy
container_name: wazy
restart: always
ports:
- "8081:8081"
environment:
- LOG_LEVEL=DEBUG
volumes:
- ./wazy:/app/config
In order to adapt Wazy to the needs of the user, several things must be defined such as addresses, routes and Telegram API key. Inside the config folder there is a file called config.ini where you can define the necessary parameters for the bot to work.
In order to enable integration with other systems, Wazy is also accessible via Rest API. In order to allow access, the port must be defined in the docker-compose file. The default port is 8081.
Wazy can be easily using the config.ini file. by default this file is empty and created on first system start. you can also copy the following content and to new file inside the config folder prior to the containr startup.
[Telegram]
bot.token=
bot.allowedid=
bot.welcome.message=Hi, my name is Voicy
bot.enabled=False
[WAZE]
route.avoid_toll_roads=False
route.avoid_subscription_roads=False
route.region=IL
route.start_address=
route.end_address=
route.max_duration=20
routes=['work2home','home2work']
address=['home','work','school','parents']
[work2home]
route.avoid_toll_roads=False
route.avoid_subscription_roads=False
route.start_address=
route.end_address=
rout.max_duration=20
[home2work]
route.avoid_toll_roads=False
route.avoid_subscription_roads=False
route.start_address=
route.end_address=
rout.max_duration=20
[ADRESSES]
address.home=
address.work=
address.parents=
address.school=
Telegram:
Waze:
work2home and home2work - example of pre-configured routes:
ADDRESSES: Pre-configured addresses that can be set as route start and end points.
As I mentioned, working with Wazy is also possible using the Rest API. API documentation can be found by adding /docs to the server address. For example http://wazy:8081/docs.
"/route/get": Get travel time for route between addtesses:
"/route/default": Get travel time for default route that was configured in the config.ini file.
"/route/byname" : Get travel time for route by it's name.
"/route/locations": Get travel time between to addresses taken the configuration file ander [ADDRESSES] section.