Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ jobs:

Notify a Telegram channel with a custom message at any point in a job with this custom step.

| Parameter | Type | Default | Description |
| ---------------------- | -------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `message` | `string` | Message from CircleCI. | Enter a custom message. |
| `telegram-bot-token` | `env_var_name` | TELEGRAM_BOT_TOKEN | Name of environment variable storing your Telegram bot token |
| `telegram-chat-id` | `env_var_name` | TELEGRAM_CHAT_ID | Name of environment variable storing your Telegram chat id |
| `parse_mode` | `string` | none | Use `Markdown` or `HTML`, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
| `disable_notification` | `boolean` | none | Sends the message silently. Users will receive a notification with no sound. |
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `message` | `string` | Message from CircleCI. | Enter a custom message. |
| `telegram-bot-token` | `env_var_name` | TELEGRAM_BOT_TOKEN | Name of environment variable storing your Telegram bot token |
| `telegram-chat-id` | `env_var_name` | TELEGRAM_CHAT_ID | Name of environment variable storing your Telegram chat id |
| `parse_mode` | `string` | none | Use `Markdown` or `HTML`, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
| `disable_notification` | `boolean` | none | Sends the message silently. Users will receive a notification with no sound. |
| `disable_web_page_preview` | `boolean` | none | Disables link previews for links in this message |
| `reply_markup` | `InlineKeyboardMarkup` or `ReplyKeyboardMarkup` or `ReplyKeyboardRemove` or `ForceReply` | none | Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user |


Example:

Expand Down Expand Up @@ -186,13 +189,16 @@ jobs:

Notify a Telegram channel.

| Parameter | Type | Default | Description |
| ---------------------- | -------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `message` | `string` | Job Message from CircleCI! | Enter a custom message. |
| `telegram-bot-token` | `env_var_name` | TELEGRAM_BOT_TOKEN | Name of environment variable storing your Telegram bot token |
| `telegram-chat-id` | `env_var_name` | TELEGRAM_CHAT_ID | Name of environment variable storing your Telegram chat id |
| `parse_mode` | `string` | none | Use `Markdown` or `HTML`, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
| `disable_notification` | `boolean` | none | Sends the message silently. Users will receive a notification with no sound. |
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `message` | `string` | Job Message from CircleCI! | Enter a custom message. |
| `telegram-bot-token` | `env_var_name` | TELEGRAM_BOT_TOKEN | Name of environment variable storing your Telegram bot token |
| `telegram-chat-id` | `env_var_name` | TELEGRAM_CHAT_ID | Name of environment variable storing your Telegram chat id |
| `parse_mode` | `boolean` | none | Use `Markdown` or `HTML`, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
| `disable_notification` | `boolean` | none | Sends the message silently. Users will receive a notification with no sound. |
| `disable_web_page_preview` | `boolean` | none | Disables link previews for links in this message |
| `reply_markup` | `InlineKeyboardMarkup` or `ReplyKeyboardMarkup` or `ReplyKeyboardRemove` or `ForceReply` | none | Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user |


Example:

Expand All @@ -205,6 +211,7 @@ orbs:
jobs:
- telegram/notify:
message: "Notification from CircleCI!"
disable_web_page_preview: true
```

## Help
Expand Down
13 changes: 9 additions & 4 deletions src/commands/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ parameters:
type: string
default: none

disable_notification:
description: Sends the message silently. Users will receive a notification with no sound.
disable_web_page_preview:
description: Disables link previews for links in this message.
type: boolean
default: false
default: none

reply_markup:
description: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
type: InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply
default: none

steps:
- run:
name: Telegram notification
shell: /bin/bash
command: |
curl "https://api.telegram.org/bot$<<parameters.telegram-bot-token>>/sendMessage?chat_id=$<<parameters.telegram-chat-id>>&parse_mode=<< parameters.parse_mode >>&disable_notification=<< parameters.disable_notification >>&text=<< parameters.message >>"
curl "https://api.telegram.org/bot$<<parameters.telegram-bot-token>>/sendMessage?chat_id=$<<parameters.telegram-chat-id>>&parse_mode=<< parameters.parse_mode >>&reply_markup=<< parameters.reply_markup >>&disable_web_page_preview=<< parameters.disable_web_page_preview >>&disable_notification=<< parameters.disable_notification >>&text=<< parameters.message >>"
2 changes: 2 additions & 0 deletions src/examples/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ usage:
steps:
- telegram/notify:
message: "Custom notification message."
reply_to_message_id: 3
disable_web_page_preview: true

workflows:
your-workflow:
Expand Down
13 changes: 13 additions & 0 deletions src/jobs/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ parameters:
type: string
default: none

disable_web_page_preview:
description: Disables link previews for links in this message.
type: boolean
default: none

reply_markup:
description: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
type: InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply
default: none

disable_notification:
description: Sends the message silently. Users will receive a notification with no sound.
type: boolean
Expand All @@ -36,4 +46,7 @@ steps:
telegram-bot-token: << parameters.telegram-bot-token >>
telegram-chat-id: << parameters.telegram-chat-id >>
parse_mode: << parameters.parse_mode >>
disable_web_page_preview: << parameters.disable_web_page_preview >>
reply_markup: << parameters.reply_markup >>
disable_notification: << parameters.disable_notification >>