Skip to main content
Version: 7.x

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');




## Configuration
### telegram_title
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L67)

Title of project



### telegram_token
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L72)

Telegram settings



### telegram_chat_id
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L75)





### telegram_url
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L78)





### telegram_text
[Source](https://github.com/deployphp/deployer/blob/master/contrib/telegram.php#L83)

Deploy message

```php title="Default value"
'_{{user}}_ deploying `{{branch}}` to *{{target}}*'

telegram_success_text

Source

Default value
'Deploy to *{{target}}* successful'

telegram_failure_text

Source

Default value
'Deploy to *{{target}}* failed'

Tasks

telegram:notify

Source

Notifies Telegram.



Support Deployer โค๏ธ

Hello, my name is Anton Medvedev (@antonmedv). I'm the creator of the Deployer. I maintain this open source project in my spare time. Supporters on GitHub give me extra motivation to work on the project.

Consider supporting Deployer via GitHub Sponsors.

Also, please, nominate me for GitHub Stars award. Thanks!