Telegram

Posts a message to a Telegram chat. You must create a Bot for this announcer to work. You must also obtain the chatId for the particular chat/channel where the message will be sent.

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
announce:
  # 
  telegram:
    # Enables or disables Telegram.
    # Valid 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 `telegram`, i.e, `telegramFoo`.
      foo: bar

    # The token associated with a Telegram bot.
    # If left unspecified, the `JRELEASER_TELEGRAM_TOKEN`
    # environment variable must be defined.
    #  
    token: __DO_NOT_SET_HERE__

    # The identifier of the chat where announcemnts will be posted.
    # If left unspecified, the `JRELEASER_TELEGRAM_CHAT_ID`
    # environment variable must be defined.
    #  
    chatId: __DO_NOT_SET_HERE__

    # The announcement message.
    # Review the available Name Templates.
    #  
    message: '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'

    # Path to a template file that contains the message.
    # Review the available Name Templates.
    # Defaults to `src/jreleaser/templates/mattermost.tpl`.
    # 
    messageTemplate: path/to/template/mattermost.tpl
# 
[announce.telegram]
  # Enables or disables Telegram.
  # Valid 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 `telegram`, i.e, `telegramFoo`.

  # The token associated with a Telegram bot.
  # If left unspecified, the `JRELEASER_TELEGRAM_TOKEN`
  # environment variable must be defined.
  #  
  token = "__DO_NOT_SET_HERE__"

  # The identifier of the chat where announcemnts will be posted.
  # If left unspecified, the `JRELEASER_TELEGRAM_CHAT_ID`
  # environment variable must be defined.
  #  
  chatId = "__DO_NOT_SET_HERE__"

  # The announcement message.
  # Review the available Name Templates.
  #  
  message = "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"

  # Path to a template file that contains the message.
  # Review the available Name Templates.
  # Defaults to `src/jreleaser/templates/mattermost.tpl`.
  # 
  messageTemplate = "path/to/template/mattermost.tpl"
{
  // 
  "announce": {
    // 
    "telegram": {
      // Enables or disables Telegram.
      // Valid 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 `telegram`, i.e, `telegramFoo`.
        "foo": "bar"
      },

      // The token associated with a Telegram bot.
      // If left unspecified, the `JRELEASER_TELEGRAM_TOKEN`
      // environment variable must be defined.
      //  
      "token": "__DO_NOT_SET_HERE__",

      // The identifier of the chat where announcemnts will be posted.
      // If left unspecified, the `JRELEASER_TELEGRAM_CHAT_ID`
      // environment variable must be defined.
      //  
      "chatId": "__DO_NOT_SET_HERE__",

      // The announcement message.
      // Review the available Name Templates.
      //  
      "message": "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",

      // Path to a template file that contains the message.
      // Review the available Name Templates.
      // Defaults to `src/jreleaser/templates/mattermost.tpl`.
      // 
      "messageTemplate": "path/to/template/mattermost.tpl"
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <announce>
    <!--
      
    -->
    <telegram>
      <!--
        Enables or disables Telegram.
        Valid 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 `telegram`, i.e, `telegramFoo`.
        -->
        <foo>bar</foo>
      </extraProperties>

      <!--
        The token associated with a Telegram bot.
        If left unspecified, the `JRELEASER_TELEGRAM_TOKEN` environment variable must be defined.
         
      -->
      <token>__DO_NOT_SET_HERE__</token>

      <!--
        The identifier of the chat where announcemnts will be posted.
        If left unspecified, the `JRELEASER_TELEGRAM_CHAT_ID`
        environment variable must be defined.
         
      -->
      <chatId>__DO_NOT_SET_HERE__</chatId>

      <!--
        The announcement message.
        Review the available Name Templates.
         
      -->
      <message>🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>

      <!--
        Path to a template file that contains the message.
        Review the available Name Templates.
        Defaults to `src/jreleaser/templates/mattermost.tpl`.
        
      -->
      <messageTemplate>path/to/template/mattermost.tpl</messageTemplate>
    </telegram>
  </announce>
</jreleaser>
jreleaser {
  // 
  announce {
    // 
    telegram {
      // Enables or disables Telegram.
      // Valid 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 `telegram`, i.e, `telegramFoo`.
      //  
      extraProperties.put('foo', 'bar')

      // The token associated with a Telegram bot.
      // If left unspecified, the `JRELEASER_TELEGRAM_TOKEN`
      // environment variable must be defined.
      //  
      token = '__DO_NOT_SET_HERE__'

      // The identifier of the chat where announcemnts will be posted.
      // If left unspecified, the `JRELEASER_TELEGRAM_CHAT_ID`
      // environment variable must be defined.
      //  
      chatId = '__DO_NOT_SET_HERE__'

      // The announcement message.
      // Review the available Name Templates.
      //  
      message = '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'

      // Path to a template file that contains the message.
      // Review the available Name Templates.
      // Defaults to `src/jreleaser/templates/mattermost.tpl`.
      // 
      messageTemplate = 'path/to/template/mattermost.tpl'
    }
  }
}

You may define either message or messageTemplate, with the former taking precedence over the latter.

Templates

The default location for templates is:

src/jreleaser/templates

The following list shows the filenames that may be used to override default templates:

  • telegram.tpl

Templates may be initialized using the template command