feat(webhooks): log submissions to Discord servers via webhooks#196
Merged
Conversation
Adds a delivery format to webhooks. Alongside the existing generic JSON
(HMAC-signed) hooks, a guild can now register a Discord channel webhook URL and
have submissions posted there as a formatted embed. This works for any Discord
server, including ones the bot is not a member of, so a guild can mirror new
submissions and status changes into an external log channel.
- schema: webhooks.format ("json" | "discord") (+ migration)
- shared: WEBHOOK_FORMATS, Discord webhook URL validation on the input schema,
and buildDiscordWebhookBody() to render a SubmissionWebhookPayload as an embed
- bot: the delivery poller branches on format; discord hooks send the embed body
without an HMAC signature (Discord does not verify one)
- dashboard: a format selector on the webhooks page; Discord hooks show a badge,
a Discord-specific URL hint, and hide the signing secret (not applicable)
Reuses the existing webhook outbox, retry/backoff and event selection. Localized
in all 7 languages. Added shared tests for the format validation and embed.
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.
Feature request: option to log submissions to other servers using webhooks.
What changed
Webhooks now have a delivery format. Alongside the existing generic JSON (HMAC-signed) hooks, a guild can register a Discord channel webhook URL and have submissions posted there as a formatted embed. This works for any Discord server, including ones the bot is not a member of, so a guild can mirror new submissions and status changes into an external log channel.
Details
webhooks.format(json|discord, defaultjson) + migration.WEBHOOK_FORMATS, Discord webhook URL validation onwebhookInputSchema(adiscordhook must be a realdiscord.com/api/webhooks/...URL), andbuildDiscordWebhookBody()which renders aSubmissionWebhookPayloadas an embed (applicant, status/transition, score, formatted answers, truncated to Discord's limits).X-MSK-Signature(Discord does not verify one); JSON hooks are unchanged.Reuses the existing webhook outbox, retry/backoff and per-event selection. On the same Pro-gated Webhooks tab as the generic hooks. Localized in all 7 languages. Added shared tests for the format validation and embed rendering. Typecheck, lint, tests (shared 90) and build all green. Migration applies via the deploy
prisma migrate deploy.How to use
Webhooks tab, Add endpoint, pick Discord webhook, paste a channel webhook URL from any server (Server Settings, Integrations, Webhooks), choose the events, done.