deployer/docs/contrib/telegram.md
2020-11-16 10:56:42 +01:00

3.4 KiB
Raw Blame History

telegram

Source

Installing

  1. Create telegram bot with 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:
require 'contrib/telegram.php';

Add hook on deploy:

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 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:

before('deploy', 'telegram:notify');

If you want to notify about successful end of deployment add this too:

after('deploy:success', 'telegram:notify:success');

If you want to notify about failed deployment add this too:

after('deploy:failed', 'telegram:notify:failure');




* Config
  * [`telegram_title`](#telegram_title)
  * [`telegram_token`](#telegram_token)
  * [`telegram_chat_id`](#telegram_chat_id)
  * [`telegram_url`](#telegram_url)
  * [`telegram_text`](#telegram_text)
  * [`telegram_success_text`](#telegram_success_text)
  * [`telegram_failure_text`](#telegram_failure_text)
* Tasks
  * [`telegram:notify`](#telegramnotify)

## Config
### telegram_title
[Source](https://github.com/deployphp/deployer/search?q=%22telegram_title%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Atelegram.php)

Title of project

### telegram_token
[Source](https://github.com/deployphp/deployer/search?q=%22telegram_token%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Atelegram.php)

Telegram settings

### telegram_chat_id
[Source](https://github.com/deployphp/deployer/search?q=%22telegram_chat_id%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Atelegram.php)



### telegram_url
[Source](https://github.com/deployphp/deployer/search?q=%22telegram_url%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Atelegram.php)



### telegram_text
[Source](https://github.com/deployphp/deployer/search?q=%22telegram_text%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Atelegram.php)

Deploy message

### telegram_success_text
[Source](https://github.com/deployphp/deployer/search?q=%22telegram_success_text%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Atelegram.php)



### telegram_failure_text
[Source](https://github.com/deployphp/deployer/search?q=%22telegram_failure_text%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Atelegram.php)




## Tasks
### telegram:notify
[Source](https://github.com/deployphp/deployer/search?q=%22telegram%3Anotify%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Atelegram.php)