Aisyah AI is a powerful Telegram bot built with Cloudflare Workers that combines multiple AI capabilities. It can browse the web, set reminders, speak, predict weather, analyze images, and understand voice messages. The bot maintains context in conversations through Redis, making it perfect for both private chats and group interactions.
? Advanced AI Capabilities
Smart Tools
☁️ Modern Architecture
? API Integrations
We've chosen to exclusively support OpenAI models (particularly gpt-3.5-turbo and gpt-4o-mini) for several reasons:
Note: We understand the interest in alternative models and providers (like OpenRouter, Anthropic, etc.). However, to maintain code simplicity and ensure consistent bot behavior, we've decided to focus on OpenAI's offerings. If you need to use different models, you'll need to fork the project and modify the model configurations accordingly.
/start
- Begin interaction with the bot/settings
- Configure bot settings (LLM model, persona, voice, etc.)/help
- Get help about available commandsNote: This is a personal project designed for learning and experimentation purposes.
The project is organized into several microservices:
aisyah-ai-telegraph
: Main orchestrator that handles Telegram interactionsaisyah-ai-agent
: Core AI agent that processes requestsaisyah-ai-explorer
: Web browsing capabilityaisyah-ai-reminder
: Reminder managementaisyah-ai-sonata
: Text-to-speech serviceaisyah-ai-storm
: Weather predictionaisyah-ai-vision
: Image analysisaisyah-ai-whisper
: Speech-to-text serviceClone the repository:
git clone https://github.com/husniadil/aisyah-ai.git
cd aisyah-ai
Install dependencies:
yarn install
Set up Cloudflare: First, get your Cloudflare API Token:
export CLOUDFLARE_API_TOKEN=your_api_token_here
echo 'export CLOUDFLARE_API_TOKEN=your_api_token_here' >> ~/.zshrc
Note: Do not use wrangler login
as it conflicts with the API token authentication method.
Configure environment files:
# Copy Cloudflare configuration files
cp packages/aisyah-ai-agent/wrangler.toml.example packages/aisyah-ai-agent/wrangler.toml
cp packages/aisyah-ai-explorer/wrangler.toml.example packages/aisyah-ai-explorer/wrangler.toml
cp packages/aisyah-ai-reminder/wrangler.toml.example packages/aisyah-ai-reminder/wrangler.toml
cp packages/aisyah-ai-sonata/wrangler.toml.example packages/aisyah-ai-sonata/wrangler.toml
cp packages/aisyah-ai-storm/wrangler.toml.example packages/aisyah-ai-storm/wrangler.toml
cp packages/aisyah-ai-telegraph/wrangler.toml.example packages/aisyah-ai-telegraph/wrangler.toml
cp packages/aisyah-ai-vision/wrangler.toml.example packages/aisyah-ai-vision/wrangler.toml
cp packages/aisyah-ai-whisper/wrangler.toml.example packages/aisyah-ai-whisper/wrangler.toml
# Copy environment variables
cp packages/aisyah-ai-agent/.dev.vars.example packages/aisyah-ai-agent/.dev.vars
cp packages/aisyah-ai-explorer/.dev.vars.example packages/aisyah-ai-explorer/.dev.vars
cp packages/aisyah-ai-reminder/.dev.vars.example packages/aisyah-ai-reminder/.dev.vars
cp packages/aisyah-ai-sonata/.dev.vars.example packages/aisyah-ai-sonata/.dev.vars
cp packages/aisyah-ai-storm/.dev.vars.example packages/aisyah-ai-storm/.dev.vars
cp packages/aisyah-ai-telegraph/.dev.vars.example packages/aisyah-ai-telegraph/.dev.vars
cp packages/aisyah-ai-vision/.dev.vars.example packages/aisyah-ai-vision/.dev.vars
cp packages/aisyah-ai-whisper/.dev.vars.example packages/aisyah-ai-whisper/.dev.vars
Configure package-specific settings:
Create the required KV namespaces and make note of their IDs:
# For settings storage
yarn w aisyah-ai-agent wrangler kv:namespace create SETTINGS
# For chat history
yarn w aisyah-ai-telegraph wrangler kv:namespace create CHAT_HISTORY
# For reminders
yarn w aisyah-ai-reminder wrangler kv:namespace create REMINDERS
# In packages/aisyah-ai-telegraph/.dev.vars
CLOUDFLARE_SUBDOMAIN=your_subdomain
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
UPSTASH_REDIS_REST_URL=your_redis_rest_url
UPSTASH_REDIS_REST_TOKEN=your_redis_rest_token
# In packages/aisyah-ai-agent/.dev.vars
OPENAI_API_KEY=your_openai_api_key
LANGCHAIN_API_KEY=your_langchain_api_key
CLOUDFLARE_SUBDOMAIN=your_subdomain
AGENT_PERSONA_AISYAH_DEFAULT=your_system_prompt_for_persona_default
AGENT_PERSONA_AISYAH_JAWIR=your_system_prompt_for_persona_jawir
AGENT_PERSONA_PERSONAL_ASSISTANT=your_system_prompt_for_persona_personal_assistant
# In packages/aisyah-ai-vision/.dev.vars
OPENAI_API_KEY=your_openai_api_key
# In packages/aisyah-ai-whisper/.dev.vars
OPENAI_API_KEY=your_openai_api_key
# In packages/aisyah-ai-sonata/.dev.vars
OPENAI_API_KEY=your_openai_api_key
# Get from https://supabase.io
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_storage_key
# Get from https://elevenlabs.io
ELEVENLABS_API_KEY=your_elevenlabs_api_key
# In packages/aisyah-ai-storm/.dev.vars
OPEN_WEATHER_MAP_API_KEY=your_openweathermap_api_key
# In packages/aisyah-ai-explorer/.dev.vars
# Get from https://programmablesearchengine.google.com/
GOOGLE_SEARCH_API_KEY=your_google_api_key
GOOGLE_SEARCH_ENGINE_ID=your_search_engine_id
# In packages/aisyah-ai-reminder/.dev.vars
REMINDERS_APP_ID=your_reminders_app_id
REMINDERS_API_KEY=your_reminders_api_key
Update each package's wrangler.toml
with the corresponding KV namespace IDs from the previous step:
# In packages/aisyah-ai-telegraph/wrangler.toml
kv_namespaces = [
{ binding = "CHAT_HISTORY", id = "your_chat_history_namespace_id" }
]
# In packages/aisyah-ai-agent/wrangler.toml
kv_namespaces = [
{ binding = "SETTINGS", id = "your_settings_namespace_id" }
]
# In packages/aisyah-ai-reminder/wrangler.toml
kv_namespaces = [
{ binding = "REMINDERS", id = "your_reminders_namespace_id" }
]
Deploy the workers:
yarn deploy
Set up your Telegram bot:
yarn w
: Run workspace-specific commandsyarn deploy
: Deploy all workersyarn types
: Generate TypeScript typesyarn format
: Format code using Biomepackages
directorywrangler.toml
aisyah-ai-agent
Set up a Redis instance:
Configure Redis in your environment:
# Add to packages/aisyah-ai-telegraph/.dev.vars
UPSTASH_REDIS_REST_URL=your_redis_rest_url
UPSTASH_REDIS_REST_TOKEN=your_redis_rest_token
Make sure to obtain and configure these API keys:
Add them to the respective .dev.vars
files in each package.
Worker Deployment Fails
wrangler.toml
are uniqueBot Not Responding
Features Not Working
Enable debug mode by setting:
# Add to .dev.vars
DEBUG_MODE=true
This will provide more detailed logs in the worker console.
If you encounter issues:
This project is licensed under the MIT License - see the LICENSE file for details.