- Auto-detection: Automatically detects if text is English or Sinhala and translates accordingly
- Simple usage: Just type any text - no commands needed
- Azure integration: Uses Azure Translator service for accurate translations
- Teams native: Works directly in Teams chats, groups, and channels
- Flask web app as the bot backend
- Azure Bot Service for Teams integration
- Azure Translator for translation services
- Azure App Service for hosting
- User types text in Teams
- Bot detects language (English or Sinhala)
- Translates to the other language using Azure Translator
- Returns formatted translation
Completely FREE using Azure's free tiers:
- Azure Translator F0: 2M characters/month free
- Azure App Service F1: Free tier
- Bot Service: Free for standard channels
- Create Azure Translator service
- Deploy the Python bot to Azure App Service
- Register bot in Azure Bot Service
- Enable Teams channel
- Install in Teams using the manifest
The bot automatically handles language detection using Unicode character ranges for Sinhala text, making it incredibly simple to use - just type and get instant translations!
- Azure subscription
- Python 3.8+
- Microsoft Teams account with admin access
# Login to Azure CLI
az login
# Create resource group
az group create --name translation-bot-rg --location eastus
# Create Translator service
az cognitiveservices account create --name translation-service --resource-group translation-bot-rg --kind TextTranslation --sku F0 --location eastus
# Get the key
az cognitiveservices account keys list --name translation-service --resource-group translation-bot-rg# Create App Service Plan
az appservice plan create --name translation-bot-plan --resource-group translation-bot-rg --sku F1 --is-linux
# Create Web App
az webapp create --name your-translation-bot --resource-group translation-bot-rg --plan translation-bot-plan --runtime "PYTHON|3.9"- Go to Azure Portal → "Bot Services" → "Create"
- Fill in:
- Bot handle:
translation-bot - Subscription: Your subscription
- Resource group:
translation-bot-rg - Pricing tier: F0 (Free)
- App ID: Create new
- Messaging endpoint:
https://your-translation-bot.azurewebsites.net/api/messages
- Bot handle:
- In your Bot Service → "Configuration"
- Copy "App ID" and "App Password"
# Clone or create project directory
mkdir teams-translation-bot
cd teams-translation-bot
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Create .env file with your credentials
cp .env.example .env
# Edit .env with your actual values# Configure deployment
az webapp config appsettings set --resource-group translation-bot-rg --name your-translation-bot --settings AZURE_TRANSLATOR_KEY="your_translator_key" BOT_APP_ID="your_bot_app_id" BOT_APP_PASSWORD="your_bot_password"
# Deploy code
az webapp up --resource-group translation-bot-rg --name your-translation-bot --runtime "PYTHON:3.9"- In Azure Portal → Your Bot Service → "Channels"
- Click "Microsoft Teams" icon
- Click "Save" to enable
- Update
manifest.jsonwith your bot ID - Create two PNG icons:
color.png(192x192px)outline.png(32x32px, transparent background)
- Zip these 3 files:
manifest.json,color.png,outline.png
- Open Microsoft Teams
- Go to "Apps" → "Manage your apps" → "Upload an app"
- Upload your ZIP file
- Click "Add" to install the bot
- Start a chat with your bot in Teams
- Type: "Hello, how are you?"
- Should get Sinhala translation
- Type: "ඔබට කොහොමද?"
- Should get English translation
/help- Shows help message- Any English text - Translates to Sinhala
- Any Sinhala text - Translates to English
Hello, how are you?**Translated** (en → si):
ඔබට කොහොමද?ඔයා කොහෙද ඉන්නේ?**Translated** (si → en):
Where are you?-
Bot not responding
- Check if messaging endpoint is correct
- Verify App ID and Password are set correctly
- Check Azure App Service logs
-
Translation not working
- Verify Azure Translator key is valid
- Check if Translator service is active
- Ensure proper API permissions
-
Teams installation fails
- Verify manifest.json format
- Check if bot ID matches in manifest
- Ensure ZIP file contains all required files
# View App Service logs
az webapp log tail --resource-group translation-bot-rg --name your-translation-bot
# Check bot health
curl https://your-translation-bot.azurewebsites.net/healthTeams User → Teams Service → Azure Bot Service → Your App Service → Azure Translator → Response Back- Azure Translator (F0): Free tier - 2M characters/month
- Azure App Service (F1): Free tier
- Azure Bot Service: Free for standard channels
- Total monthly cost: $0 for basic usage
- Bot credentials are stored as environment variables
- HTTPS is enforced for all communications
- No user data is stored permanently
- Translation requests are processed through Azure's secure APIs
- Add more language pairs by modifying language detection logic
- Implement user preferences for default languages
- Add conversation context for better translations
- Include translation confidence scores
- Add support for document translation
This setup provides a fully functional, production-ready Teams translation bot with minimal complexity while using Azure's robust infrastructure.