Skip to main content
Version: 7.x

slack

Source

Installing

Add to Slack

Require slack recipe in your deploy.php file:

require 'contrib/slack.php';

Add hook on deploy:

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

Configuration

  • slack_webhook โ€“ slack incoming webhook url, required

    set('slack_webhook', 'https://hooks.slack.com/...');
  • slack_channel - channel to send notification to. The default is the channel configured in the webhook

  • slack_title โ€“ the title of application, default {{application}}

  • slack_text โ€“ notification message template, markdown supported

    set('slack_text', '_{{user}}_ deploying `{{branch}}` to *{{target}}*');
  • slack_success_text โ€“ success template, default:

    set('slack_success_text', 'Deploy to *{{target}}* successful');
  • slack_failure_text โ€“ failure template, default:

    set('slack_failure_text', 'Deploy to *{{target}}* failed');
  • slack_color โ€“ color's attachment

  • slack_success_color โ€“ success color's attachment

  • slack_failure_color โ€“ failure color's attachment

  • slack_fields - set attachments fields for pretty output in Slack, default:

    set('slack_fields', []);

Usage

If you want to notify only about beginning of deployment add this line only:

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

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

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

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

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

Configuration

slack_channel

Source

Channel to publish to, when false the default channel the webhook will be used

Default value
false

slack_title

Source

Title of project

slack_text

Source

Deploy message

Default value
'_{{user}}_ deploying `{{target}}` to *{{hostname}}*'

slack_success_text

Source

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

slack_failure_text

Source

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

slack_rollback_text

Source

Default value
'_{{user}}_ rolled back changes on *{{target}}*'

slack_fields

Source

slack_color

Source

Color of attachment

Default value
'#4d91f7'

slack_success_color

Source

Default value
'#00c100'

slack_failure_color

Source

Default value
'#ff0909'

slack_rollback_color

Source

Default value
'#eba211'

Tasks

slack:notify

Source

Notifies Slack.

slack:notify:success

Source

Notifies Slack about deploy finish.

slack:notify:failure

Source

Notifies Slack about deploy failure.

slack:notify:rollback

Source

Notifies Slack about rollback.



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!