| name | telegram-field-bot |
| description | Build Telegram bots for construction field workers. Real-time reporting, photo uploads, task assignments, progress tracking. Integrate with n8n for automated workflows. |
| homepage | https://datadrivenconstruction.io |
| metadata | {"openclaw":{"emoji":"📱","os":["darwin","linux","win32"],"homepage":"https://datadrivenconstruction.io","requires":{"bins":"[Truncated]"}}} |
Telegram Field Bot
Overview
Field workers need simple tools. Telegram bots provide instant communication, photo sharing, and task management without training or app downloads.
"Telegram for field ops: Real-time task assignment and status updates" — DDC Community
Why Telegram?
| Feature | Benefit |
|---|
| No training | Workers already use Telegram |
| Works offline | Messages sync when connected |
| Photos/videos | Easy visual documentation |
| Groups | Team coordination |
| Bots | Automated workflows |
| Free | No per-user licensing |
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ TELEGRAM FIELD BOT │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Field Worker Bot n8n │
│ ──────────── ─── ─── │
│ │
│ 📱 Send photo ───▶ 🤖 Receive ───▶ ⚙️ Process │
│ 📝 Text report 📋 Parse 📊 Store │
│ 📍 Location 🏷️ Classify 📧 Notify │
│ ✅ Confirm 📈 Dashboard │
│ │
└─────────────────────────────────────────────────────────────────┘
Quick Start with n8n
1. Create Telegram Bot
1. Open Telegram, search @BotFather
2. Send /newbot
3. Name: "SiteReport Bot"
4. Username: "sitereport_company_bot"
5. Copy the API token
2. n8n Workflow
{
"workflow": "Telegram Field Reporting",
"nodes": [
{
"name": "Telegram Trigger",
"type": "Telegram",
"event": "message",
"token": "YOUR_BOT_TOKEN"
},
{
"name": "Parse Message",
"type": "Code",
"code": "Parse message type: text, photo, location"
},
{
"name": "Route by Type",
"type": "Switch",
"rules": ["photo", "text", "location"
Bot Commands
Python Bot Implementation
from telegram import Update, ReplyKeyboardMarkup
from telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes
import asyncio
TOKEN = "YOUR_BOT_TOKEN"
main_keyboard = ReplyKeyboardMarkup([
["📸 Photo Report", "📝 Text Report"],
["⚠️ Issue", "✅ Progress"],
["🌤️ Weather", "🦺 Safety"]
], resize_keyboard=True)
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""Welcome message"""
await update.message.reply_text(
"👷 Site Report Bot\n\n"
"Use the buttons below to submit reports.\n"
"All reports are automatically logged and processed.",
reply_markup=main_keyboard
)
async def handle_photo(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""Process photo submissions"""
photo = update.message.photo[-1]
file = await photo.get_file()
photo_path = f"photos/{update.message.chat.id}_{photo.file_id}.jpg"
await file.download_to_drive(photo_path)
caption = update.message.caption or "No description"
location =
update.message.location:
location = {
: update.message.location.latitude,
: update.message.location.longitude
}
report = {
: ,
: update.message.from_user.,
: update.message.from_user.username,
: photo_path,
: caption,
: location,
: update.message.date.isoformat()
}
update.message.reply_text(
)
():
text = update.message.text
text == :
update.message.reply_text()
text == :
update.message.reply_text()
text == :
update.message.reply_text(
)
text == :
update.message.reply_text(
)
text == :
update.message.reply_text(
)
text == :
update.message.reply_text(
)
:
report = {
: ,
: update.message.from_user.,
: update.message.from_user.username,
: text,
: update.message.date.isoformat()
}
update.message.reply_text()
():
app = Application.builder().token(TOKEN).build()
app.add_handler(CommandHandler(, start))
app.add_handler(MessageHandler(filters.PHOTO, handle_photo))
app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, handle_text))
()
app.run_polling()
__name__ == :
main()
Daily Report Aggregation
def generate_daily_report(project_id: str, date: str) -> str:
"""Aggregate all Telegram reports into daily summary"""
reports = db.query("""
SELECT * FROM telegram_reports
WHERE project_id = ? AND DATE(timestamp) = ?
ORDER BY timestamp
""", [project_id, date])
photos = [r for r in reports if r['type'] == 'photo']
issues = [r for r in reports if r['type'] == 'issue']
progress = [r for r in reports if r['type'] == 'progress']
summary = llm.summarize(f"""
Daily reports for {date}:
Photos submitted: {len(photos)}
Issues reported: {len(issues)}
Progress updates: {len(progress)}
Details:
{json.dumps(reports, indent=2)}
Generate a concise daily report summary.
""")
return summary
Group Chat Features
async def handle_group_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""Log important messages from project groups"""
keywords = ["delay", "issue", "problem", "complete", "delivered", "inspection"]
text = update.message.text.lower()
if any(kw in text for kw in keywords):
log_message({
"group_id": update.message.chat.id,
"group_name": update.message.chat.title,
"user": update.message.from_user.username,
"text": update.message.text,
"timestamp": update.message.date.isoformat()
})
Requirements
pip install python-telegram-bot requests
Resources