In the beginning, I wanted to make a tool for ops teams that gives the ability to use telegram chats as the place where team members can react to incidents from their apps. The tool should take information about the ops group, their members and the calendar of duties from Active Directory.

When I started working on the tool, I saw a more general idea behind the idea of the app for ops teams. I got that the biggest part of the functionality is a synchronization logic between Telegram and Active Directory. If I have this logic, I could make any tool which needs any data from AD. So I decided to work on a telegram bot that connects your organization members in Active Directory (AD) with telegram users.

What it does

The telegram bot connects your organization members in Active Directory (AD) with telegram users. The bot restricts unauthorized users from working with organization chats and removes inactive organization members.

List of features at the moment:

  • authorizing organization
  • authorizing organization's members
  • restricting unauthorized users to join to organization's chats
  • kicking members of organization's chats if they have been deactivated

How we built it

First, I started with the Microsoft Identity platform and Azure documentation because I didn't know anything about AD and cloud technologies from Microsoft. I got that I need to create an AD organization and an app for my future bot. I had difficulty understanding which API and OAuth method should I use. Finally, I found an optimal way to work with AD.

After, I decided to prepare an infrastructure for my bot first in Azure. I've successfully set up a docker registry, Azure Database for PostgreSQL and an app service. Not on the first try, but still. Next, I made an image of my bot that had only basic functionality and deployed it to the docker registry.

After that, I only worked on the logic of the bot. I decided to pick familiar technologies, such as Scala, Postgres, cats, http4s, Doobie, and mostly type-level stack. And it was the right decision because I've spent a lot of time thinking about how a user should interact with the telegram bot and AD. I've rewritten my code 2-3 times. Eventually, I implemented the most important features for this bot.

Challenges we ran into

Definitely when I changed original concept of the project. Also, it was hard to give up cool features in favor of the basic ones.

Accomplishments that we're proud of

The biggest accomplishment was going through all the stages of creating a product in a short time alone. I am proud that this bot already looks like an end-product.

What we learned

  • Azure Database for PostgreSQL
  • Azure App Services
  • Azure Docker Registry
  • OAuth
  • Graph API
  • Telegram API
  • Azure Active Directory

What's next for AD Sync Telegram Bot

I want to register AD Sync Telegram Bot as an enterprise application in Azure AD. After that, I am going to research how to give more abilities to the bot. The Telegram Bot API has limitations that interfere with implementing more automation scenarios, such as an automatic user addition to telegram chats.

Built With

Share this project: