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.
- 🎙️ 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
- 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)
- Clone the repository:
git clone https://github.com/yourusername/telegram-typefully-bot
cd telegram-typefully-bot
- Run the setup script:
chmod +x setup.sh
./setup.sh
-
Edit the
.env
file with your API keys -
Start the bot:
docker compose up -d
- Clone the repository:
git clone https://github.com/yourusername/telegram-typefully-bot
cd telegram-typefully-bot
- 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
- Create the voice notes directory:
mkdir voice-notes
- Build and run the bot:
cargo build --release
cargo run --release
- Start the bot with
/start
- Provide your Typefully API key when prompted
- Send a voice note to the bot
- The bot will:
- Transcribe your voice note
- Generate a social media post
- Create a draft in your Typefully account
/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
- 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
The bot is built with:
- Teloxide for Telegram integration
- SQLx for database operations
- OpenAI API for transcription and post generation
- Typefully API for draft creation
The bot uses SQLite for data storage, with tables for:
- Users and their API keys
- Voice note usage tracking
- Deleted user records
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 |
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
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the GPL-2.0 License - see the LICENSE file for details.
- 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