1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/www/docs/customization/announce/telegram.md
Carlos Alexandro Becker e0dabc1cb9
feat(telegram): ability to choose msg format, mdv2escape (#4036)
this allows to choose parse mode between `HTML` and `Markdownv2`, and
adds a new template function, `mdv2escape`, to escape the characters
according to telegram docs:
https://core.telegram.org/bots/api#formatting-options


closes #4021
2023-05-27 00:17:02 -03:00

48 lines
1.2 KiB
Markdown

# Telegram
For it to work, you'll need to
[create a new Telegram app](https://core.telegram.org/bots), and set
some environment variables on your pipeline:
- `TELEGRAM_TOKEN`
Also you need to know your channel's chat ID to talk with.
Then, you can add something like the following to your `.goreleaser.yaml`
config:
```yaml
# .goreleaser.yaml
announce:
telegram:
# Whether its enabled or not.
enabled: true
# Integer representation of your channel
#
# Templates: allowed (since v1.15)
chat_id: 123456
# Message template to use while publishing.
#
# Default: '{{ .ProjectName }} {{ mdv2escape .Tag }} is out! Check it out at {{ mdv2escape .ReleaseURL }}'
# Templates: allowed
message_template: 'Awesome project {{.Tag}} is out!'
# Parse mode.
#
# Valid options are MarkdownV2 and HTML.
#
# Default: MarkdownV2
# Since: v1.19
parse_mode: HTML
```
You can format your message using `MarkdownV2`, for reference, see the
[Telegram Bot API](https://core.telegram.org/bots/api#markdownv2-style).
!!! tip
Learn more about the [name template engine](/customization/templates/).
In the specific case of `MarkdownV2`, you'll probably need the `mdv2escape`
function.