CalendarTAP is a university project for Technologies for Advanced Programming that allows you to transform simple natural-language messages sent via Telegram into structured events on Google Calendar.
The architecture is the following:
It consists of the following component:
- Telegram Bot: ingests user requests from Telegram and writes them to a Kafka topic.
- Kafka: acts as a resilient message broker, storing raw requests, data for indexing, and final notifications in separate topics.
- Spark: consumes raw requests from Kafka, processes them using Google Gemini and Calendar APIs, and writes enriched data and notifications back to Kafka.
- Logstash: consumes the enriched data topic from Kafka and reliably loads it into Elasticsearch for indexing.
- Elasticsearch: indexes the final, enriched event data, making it searchable and available for analysis.
- Grafana: connects to Elasticsearch to allow for the visualization and monitoring of the processed data via interactive dashboards.
The project uses a .env file to manage credentials:
- Rename the
env.examplefile to.env. - Open the
.envfile with a text editor and fill in the following values:# Bot token obtained from BotFather on Telegram TELEGRAM_TOKEN=YOUR_TELEGRAM_TOKEN # API Key for Google AI Studio (Gemini) GEMINI_API_KEY=YOUR_GEMINI_API_KEY # ID of the Google Calendar to write events to # E.g., 'primary' or '[email protected]' GOOGLE_CALENDAR_ID=YOUR_CALENDAR_ID
The application requires a Google Cloud Service Account to securely interact with the Google Calendar API.
-
Create the Service Account:
- Go to the Google Cloud Console.
- Make sure you are in the correct project.
- Navigate to IAM & Admin > Service Accounts.
- Click "+ CREATE SERVICE ACCOUNT".
- Give it a name (e.g.,
calendar-bot-service) and proceed. No specific roles are needed at this stage.
-
Generate the JSON Key:
- Once the Service Account is created, click on its email address in the list.
- Go to the "KEYS" tab.
- Click "ADD KEY" -> "Create new key".
- Select JSON as the key type and click "CREATE".
- A JSON file will be downloaded.
-
Place the Key:
- Rename the downloaded JSON file to
gcp_service_account.json. - Move this file to the following folder within the project:
./spark/credentials/.
- Rename the downloaded JSON file to
-
Share Your Calendar:
- Open your Google Calendar.
- Find your Service Account's email address in the downloaded JSON file (under the
client_emailkey). - In the settings of the calendar you want to use, share it with the Service Account's email, granting it the "Make changes to events" permission.
- Start the project with the command
docker-compose up --build - Visit localhost:3000 and login using admin admin for Grafana.
- Enjoy.
