Phase 2a — add 'http' handler (sync forwarder)
All checks were successful
Docker Build / build-and-push-image (push) Successful in 53s

The http handler POSTs the Telegram Update JSON to a configurable
internal URL and expects a JSON {text} reply, which it sends back via
sendMessage. Sync : the webhook ack waits for the upstream answer
(timeout default 5s, capped at 30s — Telegram itself closes around 60s).

For slow / unreliable backends use the Phase 3 async handlers once the
queue is in place.

YAML config :

  bots:
    webappbot:
      handler: http
      http:
        url: http://webapp.webapp.svc.cluster.local:8080/telegram/update
        timeout: 5s

Refs ~/.claude/plans/pour-les-notifications-on-inherited-seal.md § Phase 2.
This commit is contained in:
2026-05-09 14:27:58 +02:00
parent 515b407db4
commit 8001460f14
3 changed files with 140 additions and 3 deletions

View File

@@ -73,6 +73,15 @@ func NewRegistry(cfg *Config, tg *TelegramClient, auth *Auth) (*Registry, error)
return nil, fmt.Errorf("bot %s uses handler=auth but AUTH_SECRET is unset", slug)
}
h = &AuthHandler{tg: tg, auth: auth}
case "http":
if b.HTTP == nil {
return nil, fmt.Errorf("bot %s uses handler=http but no `http:` config block was provided", slug)
}
hh, err := NewHTTPHandler(tg, *b.HTTP)
if err != nil {
return nil, fmt.Errorf("bot %s: %w", slug, err)
}
h = hh
case "":
return nil, fmt.Errorf("bot %s: handler missing", slug)
default: