├── tests
├── audio.mp3
├── github.png
├── video.mp4
├── voice.ogg
├── message.txt
├── github-logo.png
└── gophercolor.png
├── images
├── telegram-workflow.png
└── telegram-notification.png
├── entrypoint.sh
├── Dockerfile
├── .goreleaser.yaml
├── .github
└── workflows
│ ├── goreleaser.yml
│ └── ci.yml
├── LICENSE
├── action.yml
├── README.zh-tw.md
├── README.zh-cn.md
└── README.md
/tests/audio.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/telegram-action/HEAD/tests/audio.mp3
--------------------------------------------------------------------------------
/tests/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/telegram-action/HEAD/tests/github.png
--------------------------------------------------------------------------------
/tests/video.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/telegram-action/HEAD/tests/video.mp4
--------------------------------------------------------------------------------
/tests/voice.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/telegram-action/HEAD/tests/voice.ogg
--------------------------------------------------------------------------------
/tests/message.txt:
--------------------------------------------------------------------------------
1 | Sample message loaded from file.
2 |
3 | Commit msg: {{commit.message}}
4 |
--------------------------------------------------------------------------------
/tests/github-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/telegram-action/HEAD/tests/github-logo.png
--------------------------------------------------------------------------------
/tests/gophercolor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/telegram-action/HEAD/tests/gophercolor.png
--------------------------------------------------------------------------------
/images/telegram-workflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/telegram-action/HEAD/images/telegram-workflow.png
--------------------------------------------------------------------------------
/images/telegram-notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/telegram-action/HEAD/images/telegram-notification.png
--------------------------------------------------------------------------------
/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -eu
4 |
5 | export GITHUB="true"
6 |
7 | [ -n "$*" ] && export TELEGRAM_MESSAGE="$*"
8 |
9 | /bin/drone-telegram
10 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ghcr.io/appleboy/drone-telegram:1.4.0
2 |
3 | COPY entrypoint.sh /entrypoint.sh
4 | RUN chmod +x /entrypoint.sh
5 |
6 | WORKDIR /github/workspace
7 |
8 | ENTRYPOINT ["/entrypoint.sh"]
9 |
--------------------------------------------------------------------------------
/.goreleaser.yaml:
--------------------------------------------------------------------------------
1 | builds:
2 | - # If true, skip the build.
3 | # Useful for library projects.
4 | # Default is false
5 | skip: true
6 |
7 | changelog:
8 | use: github
9 | groups:
10 | - title: Features
11 | regexp: "^.*feat[(\\w)]*:+.*$"
12 | order: 0
13 | - title: "Bug fixes"
14 | regexp: "^.*fix[(\\w)]*:+.*$"
15 | order: 1
16 | - title: "Enhancements"
17 | regexp: "^.*chore[(\\w)]*:+.*$"
18 | order: 2
19 | - title: "Refactor"
20 | regexp: "^.*refactor[(\\w)]*:+.*$"
21 | order: 3
22 | - title: "Build process updates"
23 | regexp: ^.*?(build|ci)(\(.+\))??!?:.+$
24 | order: 4
25 | - title: "Documentation updates"
26 | regexp: ^.*?docs?(\(.+\))??!?:.+$
27 | order: 4
28 | - title: Others
29 |
--------------------------------------------------------------------------------
/.github/workflows/goreleaser.yml:
--------------------------------------------------------------------------------
1 | name: Goreleaser
2 |
3 | on:
4 | push:
5 | tags:
6 | - "*"
7 |
8 | permissions:
9 | contents: write
10 |
11 | jobs:
12 | goreleaser:
13 | runs-on: ubuntu-latest
14 | steps:
15 | - name: Checkout
16 | uses: actions/checkout@v4
17 | with:
18 | fetch-depth: 0
19 |
20 | - name: Setup go
21 | uses: actions/setup-go@v5
22 | with:
23 | go-version: "^1"
24 |
25 | - name: Run GoReleaser
26 | uses: goreleaser/goreleaser-action@v6
27 | with:
28 | # either 'goreleaser' (default) or 'goreleaser-pro'
29 | distribution: goreleaser
30 | version: latest
31 | args: release --clean
32 | env:
33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Bo-Yi Wu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/action.yml:
--------------------------------------------------------------------------------
1 | name: 'Telegram Message Notify'
2 | description: 'Sending a Telegram message'
3 | author: 'Bo-Yi Wu'
4 | inputs:
5 | to:
6 | description: 'telegram user'
7 | token:
8 | description: 'telegram token'
9 | message:
10 | description: 'telegram message'
11 | message_file:
12 | description: 'overwrite the default message template with the contents of the specified file'
13 | socks5:
14 | description: 'support socks5 proxy URL'
15 | photo:
16 | description: 'send the photo message.'
17 | document:
18 | description: 'send the document message.'
19 | sticker:
20 | description: 'send the sticker message.'
21 | audio:
22 | description: 'send the audio message.'
23 | voice:
24 | description: 'send the voice message.'
25 | location:
26 | description: 'send the location message.'
27 | venue:
28 | description: 'send the venue message.'
29 | video:
30 | description: 'send the video message.'
31 | debug:
32 | description: 'enable debug mode.'
33 | format:
34 | description: 'message format: markdown or html'
35 | disable_web_page_preview:
36 | description: 'disables link previews for links in this message'
37 | disable_notification:
38 | description: 'disables notifications for this message, supports sending a message without notification,'
39 | runs:
40 | using: 'docker'
41 | image: 'Dockerfile'
42 |
43 | branding:
44 | icon: 'message-square'
45 | color: 'blue'
46 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: telegram message
2 | on: [push]
3 | jobs:
4 | build:
5 | name: Build
6 | runs-on: ubuntu-latest
7 | steps:
8 | - uses: actions/checkout@master
9 | - name: send custom message with args
10 | uses: ./
11 | with:
12 | to: ${{ secrets.TELEGRAM_TO }}
13 | token: ${{ secrets.TELEGRAM_TOKEN }}
14 | args: The ${{ github.event_name }} event triggered first step.
15 |
16 | - name: send message using with
17 | uses: ./
18 | with:
19 | to: ${{ secrets.TELEGRAM_TO }}
20 | token: ${{ secrets.TELEGRAM_TOKEN }}
21 | message: |
22 | The ${{ github.event_name }} event triggered second step.
23 | show the github variable ref: ${{ github.ref }}
24 | show the github variable commit: ${{ github.sha }}
25 | show the github variable ref: {{ commit.ref }}
26 | show the github variable commit: {{ commit.sha }}
27 | Commit Message: ${{ github.event.head_commit.message }}
28 |
29 | - name: send default message
30 | uses: ./
31 | with:
32 | to: ${{ secrets.TELEGRAM_TO }}
33 | token: ${{ secrets.TELEGRAM_TOKEN }}
34 |
35 | - name: send photo message
36 | uses: ./
37 | with:
38 | to: ${{ secrets.TELEGRAM_TO }}
39 | token: ${{ secrets.TELEGRAM_TOKEN }}
40 | message: send photo message
41 | photo: "./tests/github.png"
42 | document: "./tests/gophercolor.png"
43 |
44 | - name: send location message
45 | uses: ./
46 | with:
47 | to: ${{ secrets.TELEGRAM_TO }}
48 | token: ${{ secrets.TELEGRAM_TOKEN }}
49 | location: "24.9163213 121.1424972"
50 | venue: "35.661777 139.704051 竹北體育館 新竹縣竹北市"
51 |
52 | - name: send custom message
53 | uses: ./
54 | with:
55 | to: ${{ secrets.TELEGRAM_TO }}
56 | token: ${{ secrets.TELEGRAM_TOKEN }}
57 | message: |
58 | The ${{ github.event_name }} event triggered final step.
59 | echo This event is a pull request that had an assignee removed.
60 |
61 | - name: send message file
62 | uses: ./
63 | with:
64 | to: ${{ secrets.TELEGRAM_TO }}
65 | token: ${{ secrets.TELEGRAM_TOKEN }}
66 | message_file: tests/message.txt
67 |
68 | # - name: send message using socks5 proxy URL
69 | # uses: appleboy/telegram-action@master
70 | # with:
71 | # to: ${{ secrets.TELEGRAM_TO }}
72 | # token: ${{ secrets.TELEGRAM_TOKEN }}
73 | # socks5: "http://222.124.154.19:23500"
74 | # message: Send message from socks5 proxy URL.
75 |
76 | # - name: try multiple message
77 | # uses: appleboy/telegram-action@master
78 | # with:
79 | # to: ${{ secrets.TELEGRAM_TO }}
80 | # token: ${{ secrets.TELEGRAM_TOKEN }}
81 | # format: html
82 | # message: |
83 | # ⚡️ Commits pushed to master by ${{ github.event.push.pusher.name }} ⚡️
84 | # ${{ github.actor }}:${{ github.event.head_commit.message }}
85 |
86 | - name: link preview
87 | uses: ./
88 | with:
89 | to: ${{ secrets.TELEGRAM_TO }}
90 | token: ${{ secrets.TELEGRAM_TOKEN }}
91 | message: |
92 | show link preview https://google.com.tw
93 |
94 | - name: disable link preview
95 | uses: ./
96 | with:
97 | to: ${{ secrets.TELEGRAM_TO }}
98 | token: ${{ secrets.TELEGRAM_TOKEN }}
99 | disable_web_page_preview: true
100 | message: |
101 | disable link preview https://google.com.tw
102 |
103 | - name: sending a message without notification
104 | uses: ./
105 | with:
106 | to: ${{ secrets.TELEGRAM_TO }}
107 | token: ${{ secrets.TELEGRAM_TOKEN }}
108 | disable_notification: true
109 | message: |
110 | disable link preview https://google.com.tw
111 |
--------------------------------------------------------------------------------
/README.zh-tw.md:
--------------------------------------------------------------------------------
1 | # 🚀 Telegram 的 GitHub Actions
2 |
3 | 透過 [GitHub Action](https://github.com/features/actions) 發送 Telegram 通知訊息。
4 |
5 | 
6 |
7 | [](https://github.com/appleboy/telegram-action/actions)
8 |
9 | ## 使用方式
10 |
11 | **注意**:如果您收到 "Error: Chat not found" 錯誤,請參考此 stackoverflow 上的回答 [連結](https://stackoverflow.com/a/41291666)。
12 |
13 | 發送自訂訊息並參考以下自訂變數。
14 |
15 | ## 輸入變數
16 |
17 | | 變數 | 說明 |
18 | | ------------------------ | ------------------------------------------------------------------------------------------------------- |
19 | | socks5 | 選填。支援 socks5 代理 URL |
20 | | photo | 選填。圖片訊息 |
21 | | document | 選填。文件訊息 |
22 | | sticker | 選填。貼圖訊息 |
23 | | audio | 選填。音訊訊息 |
24 | | voice | 選填。語音訊息 |
25 | | location | 選填。位置訊息 |
26 | | venue | 選填。地點訊息 |
27 | | video | 選填。影片訊息 |
28 | | debug | 選填。啟用除錯模式 |
29 | | format | 選填。`markdown` 或 `html`。參見 [MarkdownV2 格式](https://core.telegram.org/bots/api#markdownv2-style) |
30 | | message | 選填。自訂訊息 |
31 | | message_file | 選填。使用指定檔案的內容覆蓋預設訊息模板 |
32 | | disable_web_page_preview | 選填。停用此訊息中連結的預覽。預設為 `false` |
33 | | disable_notification | 選填。停用此訊息的通知,支援發送無通知的訊息。預設為 `false` |
34 |
35 | ## 範例
36 |
37 | 發送圖片訊息:
38 |
39 | ```yml
40 | - uses: actions/checkout@master
41 | - name: send photo message
42 | uses: appleboy/telegram-action@master
43 | with:
44 | to: ${{ secrets.TELEGRAM_TO }}
45 | token: ${{ secrets.TELEGRAM_TOKEN }}
46 | message: send photo message
47 | photo: tests/github.png
48 | document: tests/gophercolor.png
49 | ```
50 |
51 | 發送位置消息:
52 |
53 | ```yml
54 | - name: send location message
55 | uses: appleboy/telegram-action@master
56 | with:
57 | to: ${{ secrets.TELEGRAM_TO }}
58 | token: ${{ secrets.TELEGRAM_TOKEN }}
59 | location: '24.9163213 121.1424972'
60 | venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
61 | ```
62 |
63 | 使用自定義代理發送消息(支持 `http`、`https` 和 `socks5`),如 `socks5://127.0.0.1:1080` 或 `http://222.124.154.19:23500`
64 |
65 | ```yml
66 | - name: send message using socks5 proxy URL
67 | uses: appleboy/telegram-action@master
68 | with:
69 | to: ${{ secrets.TELEGRAM_TO }}
70 | token: ${{ secrets.TELEGRAM_TOKEN }}
71 | socks5: "http://222.124.154.19:23500"
72 | message: Send message from socks5 proxy URL.
73 | ```
74 |
75 | ## Secrets
76 |
77 | 開始使用 [Telegram Bot API](https://core.telegram.org/bots/api)。
78 |
79 | * `token`: Telegram 授權令牌。
80 | * `to`: 此聊天的唯一標識符。
81 |
82 | 如何從 telegram api 獲取唯一標識符:
83 |
84 | ```bash
85 | curl https://api.telegram.org/bot/getUpdates
86 | ```
87 |
88 | 查看結果:(獲取聊天 ID,如 `65382999`)
89 |
90 | ```json
91 | {
92 | "ok": true,
93 | "result": [
94 | {
95 | "update_id": 664568113,
96 | "message": {
97 | "message_id": 8423,
98 | "from": {
99 | "id": 65382999,
100 | "is_bot": false,
101 | "first_name": "Bo-Yi",
102 | "last_name": "Wu (appleboy)",
103 | "username": "appleboy46",
104 | "language_code": "en"
105 | },
106 | "chat": {
107 | "id": 65382999,
108 | "first_name": "Bo-Yi",
109 | "last_name": "Wu (appleboy)",
110 | "username": "appleboy46",
111 | "type": "private"
112 | },
113 | "date": 1550333434,
114 | "text": "?"
115 | }
116 | }
117 | ]
118 | }
119 | ```
120 |
121 | ## 模板變數
122 |
123 | | Github 變數 | Telegram 模板變數 |
124 | | ----------------- | ----------------- |
125 | | GITHUB_REPOSITORY | repo |
126 | | GITHUB_ACTOR | repo.namespace |
127 | | GITHUB_SHA | commit.sha |
128 | | GITHUB_REF | commit.ref |
129 | | GITHUB_WORKFLOW | github.workflow |
130 | | GITHUB_ACTION | github.action |
131 | | GITHUB_EVENT_NAME | github.event.name |
132 | | GITHUB_EVENT_PATH | github.event.path |
133 | | GITHUB_WORKSPACE | github.workspace |
134 |
--------------------------------------------------------------------------------
/README.zh-cn.md:
--------------------------------------------------------------------------------
1 | # 🚀 GitHub Actions 的 Telegram
2 |
3 | [GitHub Action](https://github.com/features/actions) 用于发送 Telegram 通知消息。
4 |
5 | 
6 |
7 | [](https://github.com/appleboy/telegram-action/actions)
8 |
9 | ## 使用方法
10 |
11 | **注意**:如果您收到 "Error: Chat not found" 错误,请参考这个 stackoverflow 的回答 [这里](https://stackoverflow.com/a/41291666)。
12 |
13 | 发送自定义消息并查看如下的自定义变量。
14 |
15 | ## 输入变量
16 |
17 | | 变量 | 描述 |
18 | | ------------------------ | ------------------------------------------------------------------------------------------------------- |
19 | | socks5 | 可选。支持 socks5 代理 URL |
20 | | photo | 可选。照片消息 |
21 | | document | 可选。文档消息 |
22 | | sticker | 可选。贴纸消息 |
23 | | audio | 可选。音频消息 |
24 | | voice | 可选。语音消息 |
25 | | location | 可选。位置消息 |
26 | | venue | 可选。场馆消息 |
27 | | video | 可选。视频消息 |
28 | | debug | 可选。启用调试模式 |
29 | | format | 可选。`markdown` 或 `html`。参见 [MarkdownV2 样式](https://core.telegram.org/bots/api#markdownv2-style) |
30 | | message | 可选。自定义消息 |
31 | | message_file | 可选。用指定文件的内容覆盖默认消息模板。 |
32 | | disable_web_page_preview | 可选。禁用此消息中链接的预览。默认值为 `false`。 |
33 | | disable_notification | 可选。禁用此消息的通知,支持发送无通知的消息。默认值为 `false`。 |
34 |
35 | ## 示例
36 |
37 | 发送照片消息:
38 |
39 | ```yml
40 | - uses: actions/checkout@master
41 | - name: send photo message
42 | uses: appleboy/telegram-action@master
43 | with:
44 | to: ${{ secrets.TELEGRAM_TO }}
45 | token: ${{ secrets.TELEGRAM_TOKEN }}
46 | message: send photo message
47 | photo: tests/github.png
48 | document: tests/gophercolor.png
49 | ```
50 |
51 | 发送位置消息:
52 |
53 | ```yml
54 | - name: send location message
55 | uses: appleboy/telegram-action@master
56 | with:
57 | to: ${{ secrets.TELEGRAM_TO }}
58 | token: ${{ secrets.TELEGRAM_TOKEN }}
59 | location: '24.9163213 121.1424972'
60 | venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
61 | ```
62 |
63 | 使用自定义代理发送消息(支持 `http`、`https` 和 `socks5`),如 `socks5://127.0.0.1:1080` 或 `http://222.124.154.19:23500`
64 |
65 | ```yml
66 | - name: send message using socks5 proxy URL
67 | uses: appleboy/telegram-action@master
68 | with:
69 | to: ${{ secrets.TELEGRAM_TO }}
70 | token: ${{ secrets.TELEGRAM_TOKEN }}
71 | socks5: "http://222.124.154.19:23500"
72 | message: Send message from socks5 proxy URL.
73 | ```
74 |
75 | ## Secrets
76 |
77 | 开始使用 [Telegram Bot API](https://core.telegram.org/bots/api)。
78 |
79 | * `token`: Telegram 授权令牌。
80 | * `to`: 此聊天的唯一标识符。
81 |
82 | 如何从 Telegram API 获取唯一标识符:
83 |
84 | ```bash
85 | curl https://api.telegram.org/bot/getUpdates
86 | ```
87 |
88 | 查看结果:(获取聊天 ID,如 `65382999`)
89 |
90 | ```json
91 | {
92 | "ok": true,
93 | "result": [
94 | {
95 | "update_id": 664568113,
96 | "message": {
97 | "message_id": 8423,
98 | "from": {
99 | "id": 65382999,
100 | "is_bot": false,
101 | "first_name": "Bo-Yi",
102 | "last_name": "Wu (appleboy)",
103 | "username": "appleboy46",
104 | "language_code": "en"
105 | },
106 | "chat": {
107 | "id": 65382999,
108 | "first_name": "Bo-Yi",
109 | "last_name": "Wu (appleboy)",
110 | "username": "appleboy46",
111 | "type": "private"
112 | },
113 | "date": 1550333434,
114 | "text": "?"
115 | }
116 | }
117 | ]
118 | }
119 | ```
120 |
121 | ## 模板变量
122 |
123 | | GitHub 变量 | Telegram 模板变量 |
124 | | ----------------- | ----------------- |
125 | | GITHUB_REPOSITORY | repo |
126 | | GITHUB_ACTOR | repo.namespace |
127 | | GITHUB_SHA | commit.sha |
128 | | GITHUB_REF | commit.ref |
129 | | GITHUB_WORKFLOW | github.workflow |
130 | | GITHUB_ACTION | github.action |
131 | | GITHUB_EVENT_NAME | github.event.name |
132 | | GITHUB_EVENT_PATH | github.event.path |
133 | | GITHUB_WORKSPACE | github.workspace |
134 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 🚀 Telegram for GitHub Actions
2 |
3 | [繁體中文](./README.zh-tw.md) | [简体中文](./README.zh-cn.md)
4 |
5 | [GitHub Action](https://github.com/features/actions) for sending Telegram notification messages.
6 |
7 | 
8 |
9 | [](https://github.com/appleboy/telegram-action/actions)
10 |
11 | ## Usage
12 |
13 | **Note**: If you receive the "Error: Chat not found" error, please refer to this StackOverflow answer [here](https://stackoverflow.com/a/41291666).
14 |
15 | Send a custom message and view the custom variables below.
16 |
17 | ```yml
18 | name: telegram message
19 | on: [push]
20 | jobs:
21 |
22 | build:
23 | name: Build
24 | runs-on: ubuntu-latest
25 | steps:
26 | - name: send telegram message on push
27 | uses: appleboy/telegram-action@master
28 | with:
29 | to: ${{ secrets.TELEGRAM_TO }}
30 | token: ${{ secrets.TELEGRAM_TOKEN }}
31 | message: |
32 | ${{ github.actor }} created commit:
33 | Commit message: ${{ github.event.commits[0].message }}
34 |
35 | Repository: ${{ github.repository }}
36 |
37 | See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
38 | ```
39 |
40 | Remove `args` to send the default message.
41 |
42 | ```yml
43 | - name: send default message
44 | uses: appleboy/telegram-action@master
45 | with:
46 | to: ${{ secrets.TELEGRAM_TO }}
47 | token: ${{ secrets.TELEGRAM_TOKEN }}
48 | ```
49 |
50 | 
51 |
52 | ## Input variables
53 |
54 | | Variable | Description |
55 | | ------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
56 | | socks5 | optional. Support socks5 proxy URL |
57 | | photo | optional. Photo message |
58 | | document | optional. Document message |
59 | | sticker | optional. Sticker message |
60 | | audio | optional. Audio message |
61 | | voice | optional. Voice message |
62 | | location | optional. Location message |
63 | | venue | optional. Venue message |
64 | | video | optional. Video message |
65 | | debug | optional. Enable debug mode |
66 | | format | optional. `markdown` or `html`. See [MarkdownV2 style](https://core.telegram.org/bots/api#markdownv2-style) |
67 | | message | optional. Custom message |
68 | | message_file | optional. Overwrite the default message template with the contents of the specified file. |
69 | | disable_web_page_preview | optional. Disables link previews for links in this message. Default is `false`. |
70 | | disable_notification | optional. Disables notifications for this message, supports sending a message without notification. Default is `false`. |
71 |
72 | ## Example
73 |
74 | Send photo message:
75 |
76 | ```yml
77 | - uses: actions/checkout@master
78 | - name: send photo message
79 | uses: appleboy/telegram-action@master
80 | with:
81 | to: ${{ secrets.TELEGRAM_TO }}
82 | token: ${{ secrets.TELEGRAM_TOKEN }}
83 | message: send photo message
84 | photo: tests/github.png
85 | document: tests/gophercolor.png
86 | ```
87 |
88 | Send location message:
89 |
90 | ```yml
91 | - name: send location message
92 | uses: appleboy/telegram-action@master
93 | with:
94 | to: ${{ secrets.TELEGRAM_TO }}
95 | token: ${{ secrets.TELEGRAM_TOKEN }}
96 | location: '24.9163213 121.1424972'
97 | venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
98 | ```
99 |
100 | Send message using custom proxy (support `http`, `https`, and `socks5`) like `socks5://127.0.0.1:1080` or `http://222.124.154.19:23500`
101 |
102 | ```yml
103 | - name: send message using socks5 proxy URL
104 | uses: appleboy/telegram-action@master
105 | with:
106 | to: ${{ secrets.TELEGRAM_TO }}
107 | token: ${{ secrets.TELEGRAM_TOKEN }}
108 | socks5: "http://222.124.154.19:23500"
109 | message: Send message from socks5 proxy URL.
110 | ```
111 |
112 | ## Secrets
113 |
114 | Getting started with [Telegram Bot API](https://core.telegram.org/bots/api).
115 |
116 | * `token`: Telegram authorization token.
117 | * `to`: Unique identifier for this chat.
118 |
119 | How to get unique identifier from telegram api:
120 |
121 | ```bash
122 | curl https://api.telegram.org/bot/getUpdates
123 | ```
124 |
125 | See the result: (get chat id like `65382999`)
126 |
127 | ```json
128 | {
129 | "ok": true,
130 | "result": [
131 | {
132 | "update_id": 664568113,
133 | "message": {
134 | "message_id": 8423,
135 | "from": {
136 | "id": 65382999,
137 | "is_bot": false,
138 | "first_name": "Bo-Yi",
139 | "last_name": "Wu (appleboy)",
140 | "username": "appleboy46",
141 | "language_code": "en"
142 | },
143 | "chat": {
144 | "id": 65382999,
145 | "first_name": "Bo-Yi",
146 | "last_name": "Wu (appleboy)",
147 | "username": "appleboy46",
148 | "type": "private"
149 | },
150 | "date": 1550333434,
151 | "text": "?"
152 | }
153 | }
154 | ]
155 | }
156 | ```
157 |
158 | ## Template variable
159 |
160 | | Github Variable | Telegram Template Variable |
161 | | ----------------- | -------------------------- |
162 | | GITHUB_REPOSITORY | repo |
163 | | GITHUB_ACTOR | repo.namespace |
164 | | GITHUB_SHA | commit.sha |
165 | | GITHUB_REF | commit.ref |
166 | | GITHUB_WORKFLOW | github.workflow |
167 | | GITHUB_ACTION | github.action |
168 | | GITHUB_EVENT_NAME | github.event.name |
169 | | GITHUB_EVENT_PATH | github.event.path |
170 | | GITHUB_WORKSPACE | github.workspace |
171 |
--------------------------------------------------------------------------------