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. |
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 webhook associated with a specific Gitter room.
# If left unspecified, the `JRELEASER_${name}_WEBHOOK`
# environment variable must be defined.
#
webhook: __DO_NOT_SET_HERE__
# 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 wrap it with the `${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 webhook associated with a specific Gitter room.
# If left unspecified, the `JRELEASER_${name}_WEBHOOK`
# environment variable must be defined.
#
webhook = "__DO_NOT_SET_HERE__"
# 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 wrap it with the `${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 webhook associated with a specific Gitter room.
// If left unspecified, the `JRELEASER_${name}_WEBHOOK`
// environment variable must be defined.
//
"webhook": "__DO_NOT_SET_HERE__",
// 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 wrap it with the `${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 webhook associated with a specific Gitter room.
If left unspecified, the `JRELEASER_${name}_WEBHOOK` environment variable must be defined.
-->
<webhook>__DO_NOT_SET_HERE__</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 wrap it with the `${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 webhook associated with a specific Gitter room.
// If left unspecified, the `JRELEASER_${name}_WEBHOOK`
// environment variable must be defined.
//
webhook = '__DO_NOT_SET_HERE__'
// 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 wrap it with the `${messageProperty}` property.
// Defaults to `true`.
//
structuredMessage = false
}
}
}
}
You may define either message
or messageTemplate
, with the former taking precedence over the latter.
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 = 'text'
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'
}
}
}
}