Skip to content

pascalporedda/telegram-typefully-bot

Repository files navigation

Telegram Voice Note to Typefully Bot

A Telegram bot that transcribes voice notes and creates social media drafts in Typefully. Built with Rust, using OpenAI's Whisper for transcription and GPT-4o-mini for post processing.

Features

  • 🎙️ Voice note transcription using OpenAI's Whisper API
  • ✍️ Automatic social media post generation
  • 📝 Direct integration with Typefully for draft creation
  • 🎁 5 minutes of free transcription
  • 🔑 Support for custom OpenAI API keys
  • 📊 Usage tracking and management

Prerequisites

  • Rust (latest stable version) OR Docker
  • SQLite (only for non-Docker setup)
  • A Telegram Bot Token (from @BotFather)
  • A Typefully API Key (from Typefully Settings)
  • An OpenAI API Key (optional for users, required for bot operator)

Setup

Using Docker (Recommended)

  1. Clone the repository:
git clone https://github.com/yourusername/telegram-typefully-bot
cd telegram-typefully-bot
  1. Run the setup script:
chmod +x setup.sh
./setup.sh
  1. Edit the .env file with your API keys

  2. Start the bot:

docker compose up -d

Manual Setup

  1. Clone the repository:
git clone https://github.com/yourusername/telegram-typefully-bot
cd telegram-typefully-bot
  1. Create a .env file in the project root:
TELOXIDE_TOKEN=your_telegram_bot_token
OPENAI_API_KEY=your_openai_api_key  # For free tier usage
  1. Create the voice notes directory:
mkdir voice-notes
  1. Build and run the bot:
cargo build --release
cargo run --release

Usage

  1. Start the bot with /start
  2. Provide your Typefully API key when prompted
  3. Send a voice note to the bot
  4. The bot will:
    • Transcribe your voice note
    • Generate a social media post
    • Create a draft in your Typefully account

Commands

  • /help - Show available commands and usage instructions
  • /setapikey - Set your own OpenAI API key (optional)
  • /settypefullykey - Update your Typefully API key
  • /usage - Check your remaining free transcription time
  • /deleteaccount - Delete your account and data

Free Usage

  • Each user gets 5 minutes of free transcription
  • After the free tier is exhausted, users need to provide their own OpenAI API key
  • Usage is tracked per user to prevent abuse

Development

The bot is built with:

Database

The bot uses SQLite for data storage, with tables for:

  • Users and their API keys
  • Voice note usage tracking
  • Deleted user records

Environment Variables

Variable Description Required
TELOXIDE_TOKEN Your Telegram Bot Token Yes
OPENAI_API_KEY OpenAI API Key for free tier usage Yes
RUST_LOG Log level (e.g., "info") No

Docker Volumes

The Docker setup uses two mounted volumes:

  • ./bot.db:/app/bot.db - SQLite database file
  • ./voice-notes:/app/voice-notes - Temporary storage for voice notes

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the GPL-2.0 License - see the LICENSE file for details.

Security Notes

  • API keys are stored in the database
  • Voice notes are automatically deleted after processing
  • Usage statistics are retained even after account deletion to prevent abuse
  • Users can provide their own OpenAI API keys for unlimited usage

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published