feat(discord-triage): post Plain replies as the agent, not a bot embed

Closed
KI
2mo ago
+121-14

Support replies relayed from Plain into Discord threads used to arrive as a purple "Superset Support" embed card. They now read like a normal message from the person who replied.

  • Replies go out through a webhook on the support channel, under the agent's name (parsed from Plain's <agent> at Superset <support@superset.sh> sender) with the bot avatar. Falls back to "Superset Support" when there's no name or Discord would reject it.
  • Long replies split on line breaks at Discord's 2000-char limit, instead of being truncated at 4000 inside the embed.
  • Mentions are disabled on relayed replies.
  • Webhook messages are bot-authored, so the follow-up relay ignores them (no echo back into Plain).
  • Without Manage Webhooks the bot posts the reply itself as a plain message. README invite permissions now include Manage Webhooks.

Manage Webhooks is already granted to the bot (member override) on #šŸ›bugs and #šŸ’”feature-request.

Test: bun test in apps/discord-triage (new cases for sender-name parsing and message splitting), typecheck and biome clean. Not yet exercised against live Discord; needs a Fly deploy after merge.

šŸ¤– Generated with Claude Code


Summary by cubic

Plain replies relayed into Discord threads now appear as normal messages from the agent via a channel webhook, instead of a "Superset Support" embed card.

  • The agent's name is parsed from Plain's <agent> at Superset <support@superset.sh> sender; it falls back to "Superset Support" when missing or invalid for Discord.
  • Long replies split at Discord's 2000-char limit on line breaks instead of being truncated in the embed.
  • Mentions are disabled, and webhook messages are bot-authored so they don't get relayed back to Plain.
  • Needs Manage Webhooks on the support channels; without it the bot posts the reply as a plain message itself. README invite permissions now include Manage Webhooks.

Summary by CodeRabbit

  • New Features
    • Support replies in Discord can now appear under the responding agent’s name with the support bot’s avatar when channel webhook access is available. Replies are posted by the bot if it isn’t.
    • Long replies are split into readable message-sized sections, with attachments included on the final section. Archived threads are reopened before replies are delivered.
  • Documentation
    • Updated setup guidance to include the Manage Webhooks permission.