feat(slack): notify on support conversations and visitor messages#335
Open
kytenz wants to merge 1 commit into
Open
feat(slack): notify on support conversations and visitor messages#335kytenz wants to merge 1 commit into
kytenz wants to merge 1 commit into
Conversation
The Slack integration only offered post/comment/changelog notifications, while the event bus already dispatches conversation.created and message.created from the support chat. Add both as routable Slack notification types: - SLACK_EVENT_CONFIG gains 'New support conversation' and 'New support message' toggles (per-channel, same as existing types) - buildSlackMessage renders both with an /admin/inbox?c=<id> deep link; agent-sent messages return null so a team's own replies never notify - slackHook treats a null message as a successful no-op
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Slack integration currently offers four notification types (new post, status change, comment, changelog), but nothing for the support inbox — teams get no Slack ping when a visitor starts a conversation or replies. The event bus already dispatches
conversation.createdandmessage.created(the generic webhook integration exposes them), so this teaches the Slack integration about them:SLACK_EVENT_CONFIG)./admin/inbox?c=<conversationId>. Visitor name/email fall back to "Anonymous visitor"; content isstripHtml+ mrkdwn-escaped + truncated likecomment.created.message.createdfires for both directions, so agent-sent messages returnnullfrombuildSlackMessage— a team's own replies never notify.slackHooktreats a null message as a successful no-op (buildSlackMessagesignature is nowSlackMessage | null).Testing
__tests__/message.test.ts: renders both events (escaping, inbox deep link, anonymous/missing-subject fallbacks), agent messages return null, unhandled event types still fall through to the generic text.bun run test apps/web/src/lib/server/integrations/slack/— 21/21 passing; changed files are eslint-clean.No schema or server-function changes — event-mapping storage already accepts arbitrary event types.