How to add the Telegram package to your Wippy application and configure it.
The dependency and its router must live in a separate file with namespace: telegram (matching the package's own
namespace). This is required because the webhook endpoint resolves its router reference at entry load time — before
ns.requirement parameter injection takes place. By defining the router in the package's namespace, the reference
telegram:router exists when the endpoint needs it.
# src/_telegram.yaml
version: "1.0"
namespace: telegram
entries:
- name: dep.telegram
kind: ns.dependency
component: butschster/telegram
version: "*"
parameters:
- name: telegram:webhook_router
value: telegram:router
- name: telegram:env_storage
value: app:env_file
# Router must be defined here (in the telegram namespace) so that
# telegram.handler:webhook.endpoint can resolve its meta.router reference.
- name: router
kind: http.router
meta:
server: app:gateway
prefix: /telegramKnown limitation: Ideally you should be able to pass any router (e.g.
app:my_router) as thewebhook_routerparameter and define everything in your app's namespace. Currentlyns.requirementinjection happens after entry references are resolved, so this workaround is needed. This will be fixed in a future Wippy release.
Your app's _index.yaml should already have these (or similar) entries:
# src/_index.yaml
version: "1.0"
namespace: app
entries:
# ── Infrastructure ─────────────────────────────────
- name: env_file
kind: env.storage.file
file_path: ./.env
auto_create: true
file_mode: 0600
- name: processes
kind: process.host
lifecycle:
auto_start: true
- name: gateway
kind: http.service
addr: ":8080"
lifecycle:
auto_start: trueSet these in your .env file:
| Variable | Required | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Yes | Bot token from @BotFather |
TELEGRAM_WEBHOOK_URL |
Yes | Public URL for webhook (e.g. https://your-domain.com/telegram/webhook) |
TELEGRAM_WEBHOOK_SECRET |
Recommended | Secret token for webhook validation |
TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
TELEGRAM_WEBHOOK_URL=https://your-domain.com/telegram/webhook
TELEGRAM_WEBHOOK_SECRET=your-random-secret-stringAfter configuration, register the webhook with Telegram:
wippy run register-webhookThis verifies your bot token via getMe, then registers the webhook URL with Telegram.
To remove the webhook later:
wippy run delete-webhookwippy runThe webhook endpoint listens at POST /telegram/webhook (path relative to your router prefix).
The package declares three ns.requirement entries that consumers must provide:
| Requirement | Injects Into | Description |
|---|---|---|
webhook_router |
.meta.router on webhook endpoint |
HTTP router where the endpoint mounts |
env_storage |
.storage on env.variable entries |
Backend for bot token and secrets |
process_host |
.host on process.service entries |
Execution host (for future stateful handlers) |