Skip to content

Gateway-hosted channels: Nostr DMs and Telegram from config #44

Closed

Description

@melvincarvalho

The defining openclaw trait jsclaw still lacks: one gateway process hosts your chat channels. All the parts exist — Channel interface, ChannelManager, per-peer bindings, a built-in zero-dep Nostr channel (NIP-04 DMs), a Telegram example — but channels only run as standalone example scripts. npx jsclaw gateway should light them up from config, next to the webchat.

Config shape

{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "allowed": ["npub1..."],
      "relays": ["wss://relay.damus.io", "wss://nos.lol"]
    },
    "telegram": {
      "botToken": "${TELEGRAM_BOT_TOKEN}",
      "allowed": [123456789]
    }
  }
}

Secrets as ${ENV_VAR} references (existing config convention). Each configured channel is constructed at gateway boot, registered with the ChannelManager, and routed through the existing bindings (channel/peer → agent, most-specific-wins; default agent main).

Nostr (first — wiring only)

createNostrChannel already exists, zero-dep, NIP-04, Schnorr verified against the Bitcoin test vectors. The gateway constructs it from channels.nostr, replies route back as encrypted DMs. Result: DM your agent from Damus/Amethyst — no bot token, no platform account, no central server.

  • allowed npub allowlist is mandatory in spirit: an open DM bot is a token-burning machine
  • Session per peer (existing sessions map pattern from examples/nostr-agent.js moves into the channel wiring)
  • Print the agent's npub at gateway boot next to the chat URL

Telegram (second — needs a zero-dep rewrite)

examples/telegram.js uses grammy; a built-in channel must not add a dependency. Long polling against the Bot API is ~100 lines of fetch: getUpdates loop, sendMessage replies, offset tracking. Same allowlist requirement (chat ids).

  • Markdown: send replies with parse_mode where safe, fall back to plain text on parse errors
  • One agent per chat id via bindings; groups later

Also

  • jsclaw status / gateway status payload lists active channels
  • Onboard wizard offers channel setup after provider selection
  • Docs: "DM your agent" page once this lands (Docs roadmap: the autonomy ladder docs#1 rungs 1–2 material)
  • Examples stay as library-usage documentation but point at the config path as the easy route

Result: npx jsclaw gateway = webchat + Nostr DMs + Telegram bot from one process and one config file — the openclaw experience on the jsclaw engine.

Activity

  1. added 3 commits that reference this issue on Jun 11, 2026
  2. melvincarvalho commented on Jun 11, 2026

    @melvincarvalho
    ContributorAuthor

    Done across PRs #50–#53: channel registry with openclaw's universal config fields (enabled/dmPolicy/allowFrom), bindings routing, Nostr and Telegram (grammy) as the first two registry entries. Verified live: one gateway answering webchat, encrypted Nostr DMs over a self-hosted relay, and Telegram DMs (@jsclaworg_bot) — same agent, three surfaces. Deferred per PoC scope: dmPolicy 'pairing', multi-account, Telegram webhooks/groups/media.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions