lingshu-gateway 0.10.0

Multi-platform messaging gateway for the Lingshu agent
docs.rs failed to build lingshu-gateway-0.10.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

lingshu-gateway

Why this crate? Your agent shouldn't live only in a terminal tab. lingshu-gateway
connects Lingshu to 15 messaging platforms — Telegram, Discord, Slack, WhatsApp, Signal,
Matrix, SMS, email, Home Assistant, and more — so you can reach it (and it can reach you)
from anywhere, on any device, without opening a laptop.

Part of Lingshu — the Rust SuperAgent.


Supported platforms

Platform Crate feature Required env vars
Telegram telegram TELEGRAM_BOT_TOKEN
Discord discord DISCORD_BOT_TOKEN
Slack slack SLACK_BOT_TOKEN, SLACK_APP_TOKEN
WhatsApp whatsapp WHATSAPP_PHONE_NUMBER_ID, WHATSAPP_ACCESS_TOKEN
Signal signal SIGNAL_CLI_PATH
Matrix matrix MATRIX_HOMESERVER, MATRIX_ACCESS_TOKEN
Mattermost mattermost MATTERMOST_URL, MATTERMOST_TOKEN
DingTalk dingtalk DINGTALK_APP_KEY, DINGTALK_APP_SECRET
SMS (Twilio) sms TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_PHONE_NUMBER
Email email EMAIL_PROVIDER, EMAIL_FROM, provider SMTP / API creds
Home Assistant homeassistant HASS_URL, HASS_TOKEN
Webhook webhook (any HTTP caller)
API server api_server API_SERVER_PORT (optional, default 8080)

Quick start

# Start the gateway (Telegram example)
export TELEGRAM_BOT_TOKEN=...
lingshu gateway --platforms telegram
# Or in ~/.lingshu/config.yaml
gateway:
  platforms: [telegram, discord]
  allowed_users: ["@alice", "123456789"]

How it works

Platform adapter → DeliveryRouter → Agent.chat() → tool loop → reply
                                                              ↓
                                              StreamConsumer (live token edit)

Each platform implements the PlatformAdapter trait. SessionManager keeps one conversation
per (platform, user_id) pair with configurable idle timeout. DeliveryRouter handles the
MEDIA://path protocol for native photo / audio / document delivery.

Per-user approval (DM pairing)

New users generate a pairing code your bot sends you in a DM. You approve with
/approve <code> in the gateway session — no server restart needed.

Add to your binary

[dependencies]
lingshu-gateway = { path = "../lingshu-gateway" }
use lingshu_gateway::GatewayRunner;

GatewayRunner::new(agent, config)
    .add_platform("telegram")?
    .run()
    .await?;

Full docs, guides, and release notes → lingshu.com