2020-10-02 00:11:13 +02:00
|
|
|
|
<!-- DO NOT EDIT THIS FILE! -->
|
|
|
|
|
<!-- Instead edit contrib/telegram.php -->
|
|
|
|
|
<!-- Then run bin/docgen -->
|
|
|
|
|
|
|
|
|
|
# telegram
|
|
|
|
|
|
|
|
|
|
[Source](/contrib/telegram.php)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Installing
|
|
|
|
|
1. Create telegram bot with [BotFather](https://t.me/BotFather) and grab the token provided
|
|
|
|
|
2. Send `/start` to your bot and open https://api.telegram.org/bot{$TELEGRAM_TOKEN_HERE}/getUpdates
|
|
|
|
|
3. Take chat_id from response
|
|
|
|
|
Require telegram recipe in your `deploy.php` file:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
require 'contrib/telegram.php';
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Add hook on deploy:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
before('deploy', 'telegram:notify');
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
|
|
- `telegram_token` – telegram bot token, **required**
|
|
|
|
|
- `telegram_chat_id` — chat ID to push messages to
|
|
|
|
|
- `telegram_proxy` - proxy connection string in [CURLOPT_PROXY](https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html) form like:
|
|
|
|
|
```
|
|
|
|
|
http://proxy:80
|
|
|
|
|
socks5://user:password@host:3128
|
|
|
|
|
```
|
|
|
|
|
- `telegram_title` – the title of application, default `{{application}}`
|
|
|
|
|
- `telegram_text` – notification message template
|
|
|
|
|
```
|
|
|
|
|
_{{user}}_ deploying `{{branch}}` to *{{target}}*
|
|
|
|
|
```
|
|
|
|
|
- `telegram_success_text` – success template, default:
|
|
|
|
|
```
|
|
|
|
|
Deploy to *{{target}}* successful
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
- `telegram_failure_text` – failure template, default:
|
|
|
|
|
```
|
|
|
|
|
Deploy to *{{target}}* failed
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
If you want to notify only about beginning of deployment add this line only:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
before('deploy', 'telegram:notify');
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If you want to notify about successful end of deployment add this too:
|
|
|
|
|
|
|
|
|
|
```php
|
2020-10-29 23:16:36 +01:00
|
|
|
|
after('deploy:success', 'telegram:notify:success');
|
2020-10-02 00:11:13 +02:00
|
|
|
|
```
|
|
|
|
|
If you want to notify about failed deployment add this too:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
after('deploy:failed', 'telegram:notify:failure');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
## Configuration
|
2020-10-02 00:11:13 +02:00
|
|
|
|
### telegram_title
|
2021-08-31 23:19:40 +02:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L67)
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
Title of project
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
|
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
### telegram_token
|
2021-08-31 23:19:40 +02:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L72)
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
Telegram settings
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
|
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
### telegram_chat_id
|
2021-08-31 23:19:40 +02:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L75)
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
|
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
### telegram_url
|
2021-08-31 23:19:40 +02:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L78)
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
|
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
### telegram_text
|
2021-08-31 23:19:40 +02:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L83)
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
Deploy message
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
```php title="Default value"
|
|
|
|
|
'_{{user}}_ deploying `{{branch}}` to *{{target}}*'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
### telegram_success_text
|
2021-08-31 23:19:40 +02:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L84)
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
```php title="Default value"
|
|
|
|
|
'Deploy to *{{target}}* successful'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
### telegram_failure_text
|
2021-08-31 23:19:40 +02:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L85)
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
```php title="Default value"
|
|
|
|
|
'Deploy to *{{target}}* failed'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
## Tasks
|
2021-08-31 23:19:40 +02:00
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
### telegram:notify
|
2021-08-31 23:19:40 +02:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L90)
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
2021-08-31 23:25:22 +02:00
|
|
|
|
.
|
|
|
|
|
|
2020-10-02 00:11:13 +02:00
|
|
|
|
|
|
|
|
|
|
2021-08-31 20:15:06 +02:00
|
|
|
|
|