Repository navigation
Description
Summary
Add Discord as a third chat platform for instance control and lifecycle notifications, alongside the existing Slack and Microsoft Teams integrations.
Motivation
Many research groups and indie/OSS communities coordinate on Discord rather than Slack or Teams. Supporting Discord would let those users control spawn instances and receive lifecycle notifications (idle warnings, TTL expiry, spot interruptions, completion) without leaving their existing workflow.
What exists today
Chat integration lives in the spawn repo:
cmd/bot.go—spawn notify/spawn botcommand tree (register, deregister, enable, disable, list, workspace-add/remove/list)- Platform routing keyed on a
--platformflag (currentlyslack,teams) - Workspace credentials stored per platform (workspace/tenant ID, bot token, signing secret)
- spored sends lifecycle notifications to the configured platform via the notifier
Docs: docs/guides/slack-setup.md, docs/guides/teams-setup.md, docs/spore-bot-self-hosting.md.
Proposed scope
1. Platform support
- Add
discordas a valid--platformvalue inspawn notifycommands spawn notify workspace-add --platform discord --workspace-id <GUILD_ID> --bot-token <BOT_TOKEN>(Discord uses a bot token; no separate signing secret — interactions use a public key for signature verification instead)spawn notify register --platform discord --platform-id <DISCORD_USER_ID> --workspace-id <GUILD_ID> --nickname <NAME> --instance-id <ID>
2. Slash commands
Mirror the existing Slack/Teams slash commands as Discord application commands:
/spore list— registered instances/spore status <name>— state, URL, TTL countdown/spore extend <name> <duration>— extend TTL/spore stop <name>— stop without SSH
Discord slash commands are registered via the application command API and dispatched through an Interactions endpoint (HTTP webhook with Ed25519 signature verification) — analogous to the Slack events endpoint and Teams bot messaging endpoint already handled in the rest-api Lambda.
3. Notifications
- spored's notifier gains a Discord sender: POST to a Discord webhook URL (or bot DM via the REST API) for idle/TTL/spot/completion events
- Format messages with Discord embeds (title, color-coded by event severity, fields for cost/TTL)
4. Interactions endpoint
- The hosted
rest-apiLambda (now inspore-host/spore-host) handles the inbound Slack/Teams webhooks. A Discord interactions handler would be added there with Ed25519 signature verification (Discord's required PING/PONG handshake + request signing).
Implementation notes
- Discord auth model differs from Slack/Teams: bot token for outbound, Ed25519 public-key signature verification for inbound interactions (not HMAC). The platform abstraction in
cmd/bot.goand the notifier interface should accommodate this. - Library:
github.com/bwmarrin/discordgois the de-facto Go Discord library, or call the REST/Gateway API directly to avoid a heavy dependency. - Self-hosting guide will need a Discord section (create application, add bot, register slash commands, set interactions endpoint URL).
Acceptance criteria
-
spawn notify workspace-add --platform discord ...works -
spawn notify register --platform discord ...works -
/spore list|status|extend|stopslash commands work in a Discord server - Lifecycle notifications (idle/TTL/spot/completion) delivered to Discord
- Discord interactions endpoint with Ed25519 signature verification in the rest-api Lambda
-
docs/guides/discord-setup.mdwritten, mirroring the Slack/Teams setup guides
Related
- Slack integration:
docs/guides/slack-setup.md - Teams integration:
docs/guides/teams-setup.md - spore-bot self-hosting:
docs/spore-bot-self-hosting.md
Activity
scttfrdmn commentedon May 29, 2026
Note on where the webhook backend lives: The chat webhook backend (
spore-botLambda — Slack/Teams interactions, slash-command dispatch) has been moved to the infrastructure monorepo atspore-host/spore-hostunderlambda/spore-bot/. It's a hosted service with no spawn/truffle coupling.So this feature spans two repos:
cmd/bot.go: adddiscordas a--platformvalue for thespawn notifyCLI commandslambda/spore-bot/: add the Discord interactions handler (Ed25519 signature verification) and Discord notification senderThe Discord setup guide goes in
spore-host/spore-hostunderdocs/guides/discord-setup.md.feat(launcher): export headless Provision + BuildLinuxBootstrap (lago…
scttfrdmn commentedon Jun 14, 2026
Implementation plan (traced against current code, 2026-06-14)
Confirmed the architecture and the exact seams. Key finding: spored never talks to chat platforms — its notifier (
spawn/pkg/agent/notifier.go) POSTs a generic event (platform,workspace_id, event type, PKCS7 identity) to the spore-bot Lambda's/notify, and the Lambda owns all platform-specific formatting + delivery. So the spawn side is thin; the bulk is the umbrellaspore-host/spore-hostlambda/spore-bot/.The feature splits cleanly into outbound notifications and inbound slash commands, with different difficulty, so I recommend phasing.
Phase 1 — Outbound Discord notifications (self-contained, high value)
spawn repo:
pkg/agent/notifier.go:platformis currently hardcoded"slack"(line ~76). Add aNotifyPlatformtopkg/providerconfig, read from a newspawn:notify-platformtag (pkg/provider/ec2.go, alongside the existingnotify-command/slack-workspace-idcases) and a--notify-platformlaunch flag; thread it into the notifier instead of the constant.cmd/bot.go: acceptdiscordinworkspace-add— Discord has no signing secret, so make--signing-secretnot-required fordiscordand add--public-key(Ed25519, used in Phase 2) + reuse--webhook-urlfor the channel webhook.--platformhelp text →slack, teams, or discord.umbrella
lambda/spore-bot/:registry.go: addPublicKeyfield toWorkspaceConfig(Discord interactions key).IncomingWebhookURLandBotTokenalready exist and are reused as-is.notify.go: branch onnr.Platform == "discord"→ post a Discord embed to the workspace's webhook URL (mirrorpostIncomingWebhook; embed with color-by-severity + cost/TTL fields). DM path via the bot REST API optional/later.discord.go:formatDiscordNotification/ embed builder.spore-host/spore-hostdocs/guides/discord-setup.md(create a Discord app, bot token, channel webhook).Phase 2 — Inbound slash commands (the harder half)
umbrella
lambda/spore-bot/only:handler.go: add a/discordroute case (mirrors/slack,/teams).discord.go: Ed25519 signature verification (Discord's scheme — distinct from Slack's HMAC inslack.go:verifySlackSignatureand the PKCS7/RSA insignature.go); the required PING (type 1) → PONG handshake; parse an application-command interaction → the existingSlashCommandstruct; map/spore list|status|extend|stop. Discord requires a response within 3s → use a deferred-response (type 5) + follow-up via the interaction token, analogous to Slack'sresponse_urlasync path (handleAsyncAction).registry.go:GetWorkspaceForSlashhandlediscord(key by guild ID; Discord doesn't send an app-id header, like Teams).scripts/helper or aspawn notify register-commands --platform discordsubcommand).Notes / decisions to make
status/extend/stop(anything doing AWS calls).PublicKey) is additive/back-compat.Suggested order: Phase 1 first (notifications work end-to-end, no interactions endpoint needed), Phase 2 after. Happy to start on Phase 1 when prioritized.
feat(spore-bot): Discord lifecycle notifications (Phase 1 of spore-ho…
feat: Discord lifecycle notifications (Phase 1 of #2) (#169)
scttfrdmn commentedon Jun 14, 2026
Phase 1 shipped — Discord lifecycle notifications
Merged across both repos:
What works now:
Lifecycle events (TTL warn, idle stop/hibernate, spot interrupt, completion) post as color-coded Discord embeds to the channel webhook. Default platform stays
slack, so existing launches are unchanged. Discord uses an Ed25519 public key (no signing secret) —--public-keyis accepted now and used by Phase 2. Setup guide:docs/guides/discord-setup.mdin the umbrella repo.Phase 2 — remaining (inbound slash commands)
Still to do, all in
lambda/spore-bot/:/discordroute inhandler.go+ Ed25519 interaction verification (vs Slack HMAC / Teams JWT)SlashCommand; map/spore list|status|extend|stopresponse_urlasync path)Leaving this issue open for Phase 2.
feat(spore-bot): Discord slash commands — Phase 2 of spore-host/spawn#2…
scttfrdmn commentedon Jun 14, 2026
Phase 2 merged — Discord slash commands (multi-tenant)
spore-host/spore-host#362 is in. The
/sporeDiscord commands are now implemented as a multi-tenant app: any user installs the published spore-bot application into their own guild and controls their own instances — separate from the community spore.host server.What's implemented:
/discordinteractions endpoint on the existing Lambda Function URL (beside/slack,/teams)./spore list|status|start|stop|hibernate|url|extend|connectdispatched through the sameBotAction/executeActionmachinery as Slack/Teams, with a deferred ack (type 5) + follow-up edit to meet Discord's 3-second deadline.scripts/register-discord-commands.shfor one-time global command registration;docs/guides/discord-setup.mdcovers the full install/registration flow.spawn notify workspace-add --platform discord --public-key …(Phase 1) is how each guild onboards.Tests: Ed25519 verify (valid/tampered/wrong-key/bad-input), interaction parse, follow-up URL — all green.
Remaining: live verification (post-deploy)
Two things need a real deployed endpoint + a Discord application, the same way Phase 1 was validated against a live webhook:
/spore status <name>round-trips (deferred ack → follow-up result) in a test guild.Both code paths are unit-tested; this is the deploy-time smoke test. Leaving #2 open until that's confirmed, then it closes as fully shipped (notifications + commands).
scttfrdmn commentedon Jun 14, 2026
✅ Phase 2 verified live — #2 complete
Both phases of Discord support are now confirmed working in production:
/sporein a registered guild returns the deferred "spore.host is thinking…" ack, then edits in the real result via the interaction follow-up — exercising Ed25519 verify → guild authorization → deferred response → async executeAction → postDiscordResponse.Verified with the app displaying as spore.host (with the mascot avatar), a guild-scoped command registration, and the empty-state list response rendering correctly.
Bug found + fixed during live setup
The first endpoint-save failed ("interactions_endpoint_url could not be verified") because the handler verified against a per-guild workspace key and 401'd the guild-less PING. Fixed (#364): verification now uses the application public key (
DISCORD_PUBLIC_KEY, one per app) before any workspace lookup; the per-guild lookup only authorizes commands afterward.Shipped
/discordinteractions endpoint,scripts/register-discord-commands.sh,docs/guides/discord-setup.md.spawn notify workspace-add --platform discord.Closing as done.