A tiny Express + TypeScript service that receives Kener webhook events and relays them to a Telegram chat with nicely formatted HTML notifications.
- Validates incoming webhook tokens via
x-kener-tokenheader (optional but recommended). - Normalizes Kener payloads and builds HTML-rich Telegram messages.
- Includes
/healthendpoint for readiness checks. - Ships with pnpm/TypeScript boilerplate, VS Code debug config, Dockerfile, and docker-compose with healthcheck.
- Node.js 22+
- pnpm
- Telegram Bot token and target chat ID
pnpm install
cp .env.example .env
# edit .env with your secrets
pnpm startThe default server listens on http://localhost:3000.
| Name | Description |
|---|---|
PORT |
Port Express listens on (default 3000). |
KENER_WEBHOOK_SECRET |
Shared secret matched against the x-kener-token header. Leave blank to disable auth. |
TELEGRAM_BOT_TOKEN |
Telegram Bot API token. Required. |
TELEGRAM_CHAT_ID |
Destination chat/channel ID. Required. |
| Command | Description |
|---|---|
pnpm start |
Runs the TypeScript entrypoint with ts-node. |
pnpm build |
Produces transpiled output in dist/. |
Press F5 and choose Debug kener-telegram-relay. The debugger launches Node with ts-node/register, so breakpoints in .ts files work out of the box.
Build and run with Docker Compose:
docker compose up -d --buildThe compose file expects a .env sitting next to it (copy from .env.example). A health check hits /health every 30 seconds. To tail logs:
docker compose logs -f appYou can also build manually:
docker build -t kener-telegram-relay .
docker run --env-file .env -p 3000:3000 kener-telegram-relay| Method | Path | Purpose |
|---|---|---|
GET |
/health |
Returns ok for health checks. |
POST |
/ |
Accepts a Kener webhook payload and forwards to Telegram. |
curl -X POST http://localhost:3000/ \
-H "Content-Type: application/json" \
-H "x-kener-token: ${KENER_WEBHOOK_SECRET}" \
-d '{
"id": "demo-1",
"alert_name": "CPU high",
"status": "TRIGGERED",
"severity": "critical"
}'Check Telegram for the formatted message.
├── src/index.ts # Express app + Telegram relay logic
├── tsconfig.json # TypeScript compiler settings
├── .vscode/launch.json # VS Code debug config
├── Dockerfile # Multi-stage container build
├── docker-compose.yml # Local orchestration with health check
└── .env.example # Documented environment variables
MIT