Skip to content
/ Wazy Public

Wazy a python based telegram bot, that helps us checking travel times using Waze route calculation.

License

Notifications You must be signed in to change notification settings

t0mer/Wazy

Repository files navigation

Wazy

Wazy is a bot based on Telegram bot that allows checking travel times using Waze.

wazy.mp4

Features

  • Check current route travel time.
  • Set interval for route travel time checks.
  • Get waze navigation url that opens in the application.
  • Set maximum travel time and get warning is the travel time exceeds the maximum.
  • Configure default rout.
  • Configure list of routes.
  • Configure addresse.
  • Rest API to integrate with other applications/systems.

Components and Frameworks used in Wazy

Installation

Before we can start working with Wazy, we need to create a new telegram bot.

Create 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.)

@Botfather

Click “Start” to activate BotFather bot.

@start

In response, you receive a list of commands to manage bots. Choose or type the /newbot command and send it.

@newbot

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.”

@username

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.

@bot_username

Docker

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

Environment

  • LOG_LEVEL - Optional valuse are: DEBUG (default), INFO, ERROR

Volumes

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.

Ports

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 configuration

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=

Sections:

  • Telegram:

    • bot.token: Bot token generated in installation section.
    • bot.welcome.message: Bot welcome message when clicking the start command.
    • bot.enabled: Enables or Disables the bot. default is set to disabled.
  • Waze:

    • route.avoid_toll_roads: When true, the waze route calculator will avoid toll roads.
    • route.avoid_subscription_roads: same as above but for subscription roads.
    • route.start_address & route.end_address: setting the default toute to check.
    • routes: List of routes that can be monitored.
    • address: List of addresses that can be set as start and end for routes.
  • work2home and home2work - example of pre-configured routes:

  • ADDRESSES: Pre-configured addresses that can be set as route start and end points.

Rest API

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.

Wazy rest API

  • "/route/get": Get travel time for route between addtesses:

    • from_address: can be any addres, like "Raanana, Israel"
    • to_address: can be any address, like "Tel aviv, Israel"
  • "/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.

About

Wazy a python based telegram bot, that helps us checking travel times using Waze route calculation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published