Channel Routing

Rules that pick which agent handles messages based on channel + identity. E.g. "all Telegram messages from chat_id 12345 โ†’ defi-strategist".

Pattern format

Patterns match against <channel>:<identity>. Wildcards (*) supported:

  • telegram:* โ€” every Telegram message
  • telegram:12345 โ€” only chat_id 12345
  • slack:U07* โ€” Slack users starting with U07
  • * โ€” everything (use sparingly)

Adding rules

curl -X POST http://127.0.0.1:18789/channel-routes \
  -d '{
    "pattern": "telegram:12345",
    "agent": "defi-strategist",
    "priority": 100,
    "label": "Primary Telegram"
  }'

Resolving a route

curl -X POST http://127.0.0.1:18789/channel-routes/resolve \
  -d '{"channel": "telegram", "identity": "12345"}'
# โ†’ {"agent": "defi-strategist"}

Priority

Higher priority wins on multi-match. Default priority is 0. Add a high-priority specific rule above wildcards to handle exceptions.

Storage

Rules stored at ~/.openvesper/channel-routes.json (mode 0600).

Source

Implementation: apps/gateway/src/channel-routing.ts

What's next?