Webhooks
Posts a message to a service that supports incoming webhooks.
Webhooks are not protected, anyone with access to the webhook URI can send messages to the target room. Prefer setting the corresponding environment variable over explicitly setting a value in the configuration DSL. |
Configuration
Legend:
-
required
-
optional
-
may use environment variable
-
accepts Name Templates
announce:
#
webhooks:
# Webhooks require a name.
#
myWebhook:
# Enable or disable this announcer.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
#
active: ALWAYS
# Defines the connection timeout in seconds.
# Defaults to `20`.
#
connectTimeout: 20
# Defines the read timeout in seconds.
# Defaults to `60`.
#
readTimeout: 60
# Additional properties used when evaluating templates.
#
extraProperties:
# Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
foo: bar
# The incoming webhook URL.
#
webhook: __USE_ENVIRONMENT_VARIABLE__
# The announcement message.
# Review the available Name Templates.
#
message: '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
# The name of the JSON property that contains the message.
# Defaults to `text`.
# Ignored if `messageTemplate` is used.
#
messageProperty: text
# Path to a template file that contains the message.
# Review the available Name Templates.
# Defaults to `src/jreleaser/templates/myWebhook.tpl`.
#
messageTemplate: path/to/template/myWebhook.tpl
# Whether to send the payload as is or format it as a
# JSON object with a `#{messageProperty}` property.
# Defaults to `true`.
#
structuredMessage: false
# Webhooks require a name.
#
[announce.webhooks.myWebhook]
# Enable or disable this announcer.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
#
active = "ALWAYS"
# Defines the connection timeout in seconds.
# Defaults to `20`.
#
connectTimeout = 20
# Defines the read timeout in seconds.
# Defaults to `60`.
#
readTimeout = 60
# Additional properties used when evaluating templates.
#
extraProperties.foo = "bar"
# Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
# The incoming webhook URL.
#
webhook = "__USE_ENVIRONMENT_VARIABLE__"
# The announcement message.
# Review the available Name Templates.
#
message = "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"
# The name of the JSON property that contains the message.
# Defaults to `text`.
# Ignored if `messageTemplate` is used.
#
messageProperty = "text"
# Path to a template file that contains the message.
# Review the available Name Templates.
# Defaults to `src/jreleaser/templates/myWebhook.tpl`.
#
messageTemplate = "path/to/template/myWebhook.tpl"
# Whether to send the payload as is or format it as a
# JSON object with a `#{messageProperty}` property.
# Defaults to `true`.
#
structuredMessage = false
{
"announce": {
//
"webhooks": {
// Webhooks require a name.
//
"myWebhook": {
// Enable or disable this announcer.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
//
"active": "ALWAYS",
// Defines the connection timeout in seconds.
// Defaults to `20`.
//
"connectTimeout": 20,
// Defines the read timeout in seconds.
// Defaults to `60`.
//
"readTimeout": 60,
// Additional properties used when evaluating templates.
//
"extraProperties": {
// Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
"foo": "bar"
},
// The incoming webhook URL.
//
"webhook": "__USE_ENVIRONMENT_VARIABLE__",
// The announcement message.
// Review the available Name Templates.
//
"message": "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",
// The name of the JSON property that contains the message.
// Defaults to `text`.
// Ignored if `messageTemplate` is used.
//
"messageProperty": "text",
// Path to a template file that contains the message.
// Review the available Name Templates.
// Defaults to `src/jreleaser/templates/myWebhook.tpl`.
//
"messageTemplate": "path/to/template/myWebhook.tpl",
// Whether to send the payload as is or format it as a
// JSON object with a `#{messageProperty}` property.
// Defaults to `true`.
//
"structuredMessage": false
}
}
}
}
<jreleaser>
<!--
-->
<announce>
<!--
-->
<webhooks>
<!--
Webhooks require a name.
-->
<myWebhook>
<!--
Enable or disable this announcer.
Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
Defaults to `NEVER`.
-->
<active>ALWAYS</active>
<!--
Defines the connection timeout in seconds.
Defaults to `20`.
-->
<connectTimeout>20</connectTimeout>
<!--
Defines the read timeout in seconds.
Defaults to `60`.
-->
<readTimeout>60</readTimeout>
<!--
Additional properties used when evaluating templates.
-->
<extraProperties>
<!--
Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
-->
<foo>bar</foo>
</extraProperties>
<!--
The incoming webhook URL.
-->
<webhook>__USE_ENVIRONMENT_VARIABLE__</webhook>
<!--
The announcement message.
Review the available Name Templates.
-->
<message>🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>
<!--
The name of the JSON property that contains the message.
Defaults to `text`.
Ignored if `messageTemplate` is used.
-->
<messageProperty>text</messageProperty>
<!--
Path to a template file that contains the message.
Review the available Name Templates.
Defaults to `src/jreleaser/templates/myWebhook.tpl`.
-->
<messageTemplate>path/to/template/myWebhook.tpl</messageTemplate>
<!--
Whether to send the payload as is or format it as a
JSON object with a `#{messageProperty}` property.
Defaults to `true`.
-->
<structuredMessage>false</structuredMessage>
</myWebhook>
</webhooks>
</announce>
</jreleaser>
jreleaser {
announce {
//
webhooks {
// Webhooks require a name.
//
myWebhook {
// Enable or disable this announcer.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
//
active = 'ALWAYS'
// Defines the connection timeout in seconds.
// Defaults to `20`.
//
connectTimeout = 20
// Defines the read timeout in seconds.
// Defaults to `60`.
//
readTimeout = 60
// Additional properties used when evaluating templates.
// Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
//
extraProperties.put('foo', 'bar')
// The incoming webhook URL.
//
webhook = '__USE_ENVIRONMENT_VARIABLE__'
// The announcement message.
// Review the available Name Templates.
//
message = '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
// The name of the JSON property that contains the message.
// Defaults to `text`.
// Ignored if `messageTemplate` is used.
//
messageProperty = 'text'
// Path to a template file that contains the message.
// Review the available Name Templates.
// Defaults to `src/jreleaser/templates/myWebhook.tpl`.
//
messageTemplate = 'path/to/template/myWebhook.tpl'
// Whether to send the payload as is or format it as a
// JSON object with a `#{messageProperty}` property.
// Defaults to `true`.
//
structuredMessage = false
}
}
}
}
You may define either message
or messageTemplate
, with the former taking precedence over the latter.
Environment
When not explicitly set, the value of the following properties may be resolved from an environment variable or a system property as shown in the table. The system property takes precedence over the environment variable.
System Property | Environment Variable |
---|---|
active |
|
jreleaser.announce.webhooks.${name}.active |
JRELEASER_ANNOUNCE_WEBHOOKS_${name}_ACTIVE |
webhook |
|
jreleaser.announce.webhooks.webhooks.${name}.webhook |
JRELEASER_ANNOUNCE_WEBHOOKS_WEBHOOKS_${name}_WEBHOOK |
Substitute ${name} for the value of the named instance. |
Space (' '), underscore (_
), and dash (-
) will be replaced by dot (.
) to separate tokens in the System property.
Space (' '), dash (-
), and dot (.
) will be replaced by underscore (_
) to separate tokens in the environment variable,
such that:
${name} | System Property | Environment Variable |
---|---|---|
foobar |
|
|
fooBar |
|
|
foo bar |
|
|
foo-bar |
|
|
foo_bar |
|
|
foo.bar |
|
|
Examples
Discord
Posts a message to a Discord room. You must create a custom webhook for this announcer to work.
-
Log into the target discord server.
-
Select the channel you want to integrate to, click on its settings icon.
-
Click on the
Integrations
menu item. -
Click on Webhooks.
-
Create a new webhook.
-
Copy the generated webhook URL.
Set a JRELEASER_DISCORD_WEBHOOK environment variable with the webhook’s url as value.
|
announce:
webhooks:
discord:
active: ALWAYS
message: '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
messageProperty: content
structuredMessage: true
[announce.webhooks.discord]
active = "ALWAYS"
message = "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"
messageProperty = "content"
structuredMessage = true
{
"announce": {
"webhooks": {
"discord": {
"active": "ALWAYS",
"message": "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",
"messageProperty": "content",
"structuredMessage": true
}
}
}
}
<jreleaser>
<announce>
<webhooks>
<discord>
<active>ALWAYS</active>
<message>🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>
<messageProperty>content</messageProperty>
<structuredMessage>true</structuredMessage>
</discord>
</webhooks>
</announce>
</jreleaser>
jreleaser {
announce {
webhooks {
discord {
active = 'ALWAYS'
message = '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
messageProperty = 'content'
structuredMessage = true
}
}
}
}
Gitter
Posts a message to a Gitter room. You must create a custom webhook for this announcer to work.
-
Log into Gitter.
-
Browse to the room you want to integrate to.
-
Click on the
Settings
menu and selectIntegrations
. -
Click on the
CUSTOM
button. -
Copy the generated webhook URL.
Set a JRELEASER_GITTER_WEBHOOK environment variable with the webhook’s url as value.
|
announce:
webhooks:
gitter:
active: ALWAYS
message: '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
messageProperty: message
structuredMessage: true
[announce.webhooks.gitter]
active = "ALWAYS"
message = "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"
messageProperty = "message"
structuredMessage = true
{
"announce": {
"webhooks": {
"gitter": {
"active": "ALWAYS",
"message": "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",
"messageProperty": "message",
"structuredMessage": true
}
}
}
}
<jreleaser>
<announce>
<webhooks>
<gitter>
<active>ALWAYS</active>
<message>🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>
<messageProperty>message</messageProperty>
<structuredMessage>true</structuredMessage>
</gitter>
</webhooks>
</announce>
</jreleaser>
jreleaser {
announce {
webhooks {
gitter {
active = 'ALWAYS'
message = '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
messageProperty = 'message'
structuredMessage = true
}
}
}
}
GoogleChat
Posts a message to a GoogleChat room. You must create a custom webhook for this announcer to work. Follow the instructions at https://developers.google.com/chat/how-tos/webhooks to register an incoming webhook.
Set a JRELEASER_GOOGLECHAT_WEBHOOK environment variable with the webhook’s url as value.
|
announce:
webhooks:
googleChat:
active: ALWAYS
message: '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
messageProperty: text
structuredMessage: true
[announce.webhooks.googleChat]
active = "ALWAYS"
message = "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"
messageProperty = "text"
structuredMessage = true
{
"announce": {
"webhooks": {
"googleChat": {
"active": "ALWAYS",
"message": "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",
"messageProperty": "text",
"structuredMessage": true
}
}
}
}
<jreleaser>
<announce>
<webhooks>
<googleChat>
<active>ALWAYS</active>
<message>🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>
<messageProperty>text</messageProperty>
<structuredMessage>true</structuredMessage>
</googleChat>
</webhooks>
</announce>
</jreleaser>
jreleaser {
announce {
webhooks {
googleChat {
active = 'ALWAYS'
message = '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
messageProperty = 'text'
structuredMessage = true
}
}
}
}
Mattermost
Posts a message to a Mattermost room. You must create a custom webhook for this announcer to work.
Set a JRELEASER_MATTERMOST_WEBHOOK environment variable with the webhook’s url as value.
|
announce:
webhooks:
mattermost:=
active: ALWAYS
message: '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
messageProperty: text
structuredMessage: true
[announce.webhooks.mattermost]
active = "ALWAYS"
message = "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"
messageProperty = "text"
structuredMessage = true
{
"announce": {
"webhooks": {
"mattermost": {
"active": "ALWAYS",
"message": "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",
"messageProperty": "text",
"structuredMessage": true
}
}
}
}
<jreleaser>
<announce>
<webhooks>
<mattermost>
<active>ALWAYS</active>
<message>🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>
<messageProperty>text</messageProperty>
<structuredMessage>true</structuredMessage>
</mattermost>
</webhooks>
</announce>
</jreleaser>
jreleaser {
announce {
webhooks {
mattermost {
active = 'ALWAYS'
message = '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
messageProperty = 'text'
structuredMessage = true
}
}
}
}
Teams
Posts a message to a Teams room. You must create a custom webhook for this announcer to work.
-
Log into Teams.
-
Click on the
Apps
icon. -
Click on the
Connectors
menu item. -
Click on
Incoming Webhook
and add it to a team. -
Configure the webhook.
-
Copy the generated webhook URL.
Set a JRELEASER_TEAMS_WEBHOOK environment variable with the webhook’s url as value.
|
announce:
webhooks:
teams:
active: ALWAYS
messageTemplate: path/to/template/teams.tpl
[announce.webhooks.teams]
active = "ALWAYS"
messageTemplate = "path/to/template/teams.tpl"
{
"announce": {
"webhooks": {
"teams": {
"active": "ALWAYS",
"messageTemplate": "path/to/template/teams.tpl"
}
}
}
}
<jreleaser>
<announce>
<webhooks>
<teams>
<active>ALWAYS</active>
<messageTemplate>path/to/template/teams.tpl</messageTemplate>
</teams>
</webhooks>
</announce>
</jreleaser>
jreleaser {
announce {
webhooks {
teams {
active = 'ALWAYS'
messageTemplate = 'path/to/template/teams.tpl'
}
}
}
}