Netlify Discord Notifications
netlify-plugin-discord is a Netlify Build plugin designed to send automated build notifications to a Discord channel via webhooks. As of its initial release (v0.0.2), it offers a straightforward way to keep development teams informed about build statuses (success, failure, etc.) directly within Discord. Its release cadence is currently unknown given its early stage. The plugin differentiates itself by providing a simple, opinionated integration specifically for Netlify's build ecosystem, contrasting with more generic webhook solutions or custom scripting that would require more setup. It focuses solely on Discord notifications, making it a targeted utility for Netlify users who utilize Discord for team communication.
Common errors
-
Discord notifications not appearing in channel.
cause DISCORD_WEBHOOK_URL is either missing, incorrect, or the Discord channel permissions are misconfigured.fixVerify the DISCORD_WEBHOOK_URL in Netlify's environment variables. Test the webhook URL directly (e.g., using `curl -H "Content-Type: application/json" -d '{"content": "Test message"}' YOUR_WEBHOOK_URL`) and ensure the Discord channel allows messages from webhooks. -
Build fails with 'Plugin "netlify-plugin-discord" failed' or similar generic error.
cause Could be an internal plugin error, an invalid webhook URL causing a fetch error, or network issues.fixCheck Netlify build logs for more specific error messages. Ensure the `DISCORD_WEBHOOK_URL` is correct and accessible. Temporarily disable the plugin to confirm it's the source of the build failure.
Warnings
- gotcha The plugin requires the DISCORD_WEBHOOK_URL environment variable to be correctly set in Netlify. Without it, notifications will not be sent, and the plugin may fail silently or with a generic error during the build process.
- gotcha Discord webhook URLs are sensitive. Ensure they are stored securely as environment variables and not committed directly into your repository. Public exposure of webhooks can lead to abuse.
- gotcha As an early-stage plugin (v0.0.2), its long-term maintenance and future breaking changes are not yet established. Be prepared for potential changes in configuration or behavior in future major releases.
Install
-
npm install netlify-plugin-discord -
yarn add netlify-plugin-discord -
pnpm add netlify-plugin-discord
Quickstart
{
"netlify.toml": """
[[plugins]]
package = "netlify-plugin-discord"
[build]
# Example build settings
command = "npm run build"
publish = "dist"
""",
"environment_variable": "DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN"
}