DEV Community

Izuchukwu Mcgibson
Izuchukwu Mcgibson

Posted on

Building an AI-Powered Focus Tracker for Telex Using Python and Gemini API

Staying focused while working remotely can be tough — distractions are everywhere. To solve that, I recently built an AI-powered Focus Tracker integrated directly into Telex, allowing users to manage work sessions, breaks, and even chat with an assistant — all from their Telex workspace.

🧠 What the Agent Does

The Focus Tracker isn’t just a timer. It acts as a smart productivity assistant that helps you:

  • ⏱️ Start/Stop focus sessions using simple commands like /focus start or /focus stop.
  • 📊 Track session progress and view your focus status anytime with /focus status.
  • 🧘 Enable daily summaries that send a quick report of your focus activity.
  • 💬 Chat with Gemini AI directly in Telex — the agent answers questions, motivates you, and provides productivity tips.

All interactions happen inside Telex, so you never have to leave your workspace.


⚙️ How It Works

The agent runs on a Python backend (hosted on Railway) with Flask handling the webhook. The key workflow looks like this:

  1. User sends a command (e.g. /focus start 30 5) to Telex.
  2. The Telex platform triggers a POST request to my /webhook endpoint.
  3. The webhook decodes the command and calls the right function:
  • start_focus() → begins a session and sets a timer.
  • stop_focus() → stops a running session.
  • status() → reports how long you’ve been focused.
    1. Responses are sent back to Telex using the send_to_telex() helper function.
    2. If the message isn’t a command, it goes straight to Google’s Gemini API for AI responses.

Here’s a small snippet of how the webhook interprets commands:

if text.startswith("/focus start"):
    return start_focus()
elif text.startswith("/focus stop"):
    return stop_focus()
elif text.startswith("/focus status"):
    return status(user_id)
else:
    ai_reply = ai_generate(text)
    send_to_telex(channel_id, ai_reply)
Enter fullscreen mode Exit fullscreen mode

The logic is simple yet flexible — making it easy to extend the agent with new commands later.


🛠️ Tech Stack

  • Python (Flask) — for the webhook and routing logic.
  • Telex API — for message delivery and channel interactions.
  • Google Gemini API — for natural language responses and productivity tips.
  • Railway — for quick and reliable deployment.
  • Environment Variables (.env) — for securely storing API keys and config values.

💡 Lessons Learned

  • You don’t always need a full dashboard — sometimes, intelligent command handling in the webhook is enough.
  • Telex makes it incredibly easy to plug in AI agents without manual configuration panels.
  • Managing environment variables properly avoids exposing sensitive API keys (like Google’s).
  • A well-structured Flask app can power multiple Telex agents with minimal duplication.

🌟 What’s Next

I plan to enhance this agent with:

  • 🔔 Focus reminders using scheduled notifications.
  • 📅 A weekly summary of total focused hours.
  • 📈 Integration with Notion or Google Sheets for focus analytics.

💬 Final Thoughts

This project taught me how AI agents can live inside team communication tools and make productivity both fun and smart. Instead of opening another app to track tasks or set timers, I can now do it conversationally — right where collaboration happens.

If you’d like to build yours, all you need is:

  • A Telex account
  • A Python server
  • A Gemini API key
  • Creativity 🧠

Author: McGibson Izuchukwu
GitHub: github.com/izuchukwuMcGibson
LinkedIn: www.linkedin.com/in/mcgibson-izuchukwu-ba09a5311

Top comments (0)