Discord Notifier

Discord Notifier provides a bridge between Jenkins and Discord through the built-in webhook functionality.

The purpose

The Jenkins Discord Webhook plugin was made to share results of a build to a Discord channel using the webhooks that Discord provides.

Through this plugin you are able to:

  • Get success and fail messages about your build
  • Link to build artifacts
  • List SCM changes to the build
  • Only send notifications on state change

Download

Discord notifier is available in official jenkins repos.

Usage

This plugin uses the post-build feature to execute a request.

After installing, go to your job's configure section and add the Discord Notifier item. Then proceed to enter your webhook URL.

Post-build dropdown with Discord Webhooks selected

There are a few options you can choose from:

  • Webhook URL
    • The URL of the webhook (pretty self-explanatory) provided by Discord
  • Send only on state change
    • Checking this will only send the message when the state of the current build differs from the previous
  • Send only failed
    • checking this will only send the failed job.
  • Advanced:
    • thumbnail
      • If set, the image under the URL shows up on the right side of Discord message.
    • Enable URL linking
      • Enables the title, build summary and build id to be linked to the build. Requires the URL to be set in Jenkins' global configuration
    • Enable artifact list
      • Enables the listing of the artifacts generated by the build
    • Enable version info in footer
      • Adds the "Jenkins version, Discord Webhook version" text in the footer of the message

Standard options in the Discord Webhook config Advanced tab in the config

Pipeline

Discord Notifier supports Jenkins Pipeline. The only required parameter is webhookURL (the URL of the webhook, of course) - but there isn't much point of sending nothing.

Parameters

  • webhookURL (required)
    • The URL of the webhook (pretty self-explanatory) provided by Discord.
  • title
    • The title of the embed.
  • link
    • If set, the title becomes a link to this URL.
  • thumbnail
    • If set, the image under the URL shows up on the right side of Discord message.
  • image
    • If set, the image under the URL shows up under discord message
  • description
  • footer
    • The text in footer of the message.
  • result
    • Sets the left side colour of the embed (SUCCESS - green, UNSTABLE - yellow, FAILURE - red, ABORTED - grey).

Example

discordSend description: "Jenkins Pipeline Build", footer: "Footer Text", link: env.BUILD_URL, result: currentBuild.currentResult, title: env.JOB_NAME, webhookURL: "Webhook URL"