mirror of
https://github.com/appleboy/telegram-action.git
synced 2026-05-14 02:42:44 +00:00
@@ -2,36 +2,35 @@
|
|||||||
|
|
||||||
[GitHub Action](https://developer.github.com/actions/) for sending a Telegram notification message.
|
[GitHub Action](https://developer.github.com/actions/) for sending a Telegram notification message.
|
||||||
|
|
||||||
<img src="./images/telegram-notification.png">
|

|
||||||
|
|
||||||
|
[](https://github.com/appleboy/facebook-action/actions)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Send custom message and see the custom variable as blow.
|
Send custom message and see the custom variable as blow.
|
||||||
|
|
||||||
```
|
```yml
|
||||||
action "Send Custom Message" {
|
- name: send custom message
|
||||||
uses = "appleboy/telegram-action@master"
|
uses: appleboy/telegram-action@master
|
||||||
secrets = [
|
env:
|
||||||
"TELEGRAM_TOKEN",
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
"TELEGRAM_TO",
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
]
|
with:
|
||||||
args = "A new commit has been pushed. commit sha: {{ commit.sha }}"
|
args: The ${{ github.event_name }} event triggered first step.
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove `args` to send the default message.
|
Remove `args` to send the default message.
|
||||||
|
|
||||||
```
|
```yml
|
||||||
action "Send Default Message" {
|
- name: send default message
|
||||||
uses = "appleboy/telegram-action@master"
|
uses: appleboy/telegram-action@master
|
||||||
secrets = [
|
env:
|
||||||
"TELEGRAM_TOKEN",
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
"TELEGRAM_TO",
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<img src="images/telegram-workflow.png">
|

|
||||||
|
|
||||||
## Environment variables
|
## Environment variables
|
||||||
|
|
||||||
@@ -48,18 +47,16 @@ action "Send Default Message" {
|
|||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
```
|
```yml
|
||||||
action "Send photo message" {
|
- name: send photo message
|
||||||
uses = "appleboy/telegram-action@master"
|
uses: appleboy/telegram-action@master
|
||||||
secrets = [
|
with:
|
||||||
"TELEGRAM_TOKEN",
|
message: send photo message
|
||||||
"TELEGRAM_TO",
|
photo: tests/github.png
|
||||||
]
|
document: tests/gophercolor.png
|
||||||
env = {
|
env:
|
||||||
PHOTO = "tests/github.png"
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
}
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
args = "A new commit has been pushed."
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Secrets
|
## Secrets
|
||||||
@@ -71,8 +68,8 @@ Getting started with [Telegram Bot API](https://core.telegram.org/bots/api).
|
|||||||
|
|
||||||
How to get unique identifier from telegram api:
|
How to get unique identifier from telegram api:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ curl https://api.telegram.org/bot<token>/getUpdates
|
curl https://api.telegram.org/bot<token>/getUpdates
|
||||||
```
|
```
|
||||||
|
|
||||||
See the result: (get chat id like `65382999`)
|
See the result: (get chat id like `65382999`)
|
||||||
|
|||||||
Reference in New Issue
Block a user