feat(bot): add Vercel JS webhook gateway with Televerse forwarding skeleton#53
Merged
SEVAAIGNATYEV merged 6 commits intoHyperlinksSpace:mainfrom Feb 26, 2026
Merged
Conversation
Member
Review: chore(unified) scaffold modular unified serviceVerdict: Approve — worth merging. One optional robustness fix below. What's good
Security / vulnerabilities
No vulnerabilities identified. Optional fix (non-blocking)In if "application/json" in content_type:
try:
return JSONResponse(status_code=upstream.status_code, content=upstream.json())
except ValueError:
pass
return Response(content=upstream.content, status_code=upstream.status_code, media_type=content_type or None)Minor
Conclusion: Safe to merge. No security issues; optional to add the JSON robustness fix in this PR or a follow-up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Title
feat(bot): add Vercel JS webhook gateway with Televerse forwarding skeletonSummary
This PR adds a production-safe Telegram webhook gateway in
front/api/bot.jsand isolates bot logic intofront/bot-service/*.The gateway handles core commands locally (
/start,/help,/ping), applies strict webhook safety checks, and can optionally forward sanitized updates to a Televerse (Dart) downstream service.Confirmed Direction
Gateway Contract
GET /api/botPOST /api/botX-Telegram-Bot-Api-Secret-Token(when configured).200 { ok: true }immediately after validation (antifragile ACK behavior).Core Behavior
/startAI_HEALTH_TIMEOUT_MSdefault1200200..1500AI_HEALTH_CACHE_TTL_MS, default30000)/helpand/pinghandled locally in gatewaySecurity and Reliability
401on mismatch)TELEGRAM_BODY_LIMIT_BYTES, default262144)telegram_webhook_error,update_id,chat_id,update_kind)Televerse Forwarding Contract (Skeleton)
Gateway forwards a reduced envelope to:
POST {TELEVERSE_BASE_URL}/internal/process-updateX-Internal-Key: {TELEVERSE_INTERNAL_KEY}Envelope shape:
{ "update_id": 123, "chat_id": 1, "user_id": 2, "text": "hi", "message_id": 10, "is_command": false, "command": null, "timestamp": 1700000000 }Files Added
front/api/bot.jsfront/bot-service/config.jsfront/bot-service/logger.jsfront/bot-service/text.jsfront/bot-service/ai-health.jsfront/bot-service/telegram.jsfront/bot-service/downstream.jsfront/bot-service/router.jsfront/scripts/set-telegram-webhook.mjsfront/scripts/delete-telegram-webhook.mjsFiles Updated
front/vercel.jsonfront/README.mdManual Smoke Checklist
BOT_TOKEN,TELEGRAM_WEBHOOK_SECRET, optional AI/Televerse vars).node front/scripts/set-telegram-webhook.mjswithTELEGRAM_WEBHOOK_URL=https://<domain>/api/bot./startwith healthy AI endpoint => prompt suggestion appears.AI_HEALTH_URL=>/startsafe fallback without prompt suggestion.401.Notes
front/api/*.jsVercel style for fast merge and single-root deployment.apps/botprototype is not part of this PR scope.