|
1 | | -# How to send slack notifications? |
| 1 | +# How to send Slack notifications? |
2 | 2 |
|
3 | | -TODO |
| 3 | +* First you need to require the recipe `recipe/slack.php` to include its tasks and options. |
| 4 | +* Then you have to provide your `slack_webhook`. More options are available for customizing the messages, the colors, etc. Check the last section for all available options. |
| 5 | +* Then hook the Slack tasks into your deployment flow. |
| 6 | + |
| 7 | +```php |
| 8 | +require 'recipe/laravel-deployer.php'; |
| 9 | +require 'recipe/slack.php'; |
| 10 | + |
| 11 | +// ... |
| 12 | + |
| 13 | +set('slack_webhook', 'YOUR_SLACK_WEBHOOK'); |
| 14 | +before('deploy', 'slack:notify'); |
| 15 | +after('success', 'slack:notify:success'); |
| 16 | +after('deploy:failed', 'slack:notify:failure'); |
| 17 | +``` |
| 18 | + |
| 19 | +# Available tasks |
| 20 | + |
| 21 | +| task | description | |
| 22 | +| - | - | |
| 23 | +| `slack:notify` | Notify about the beginning of deployment. | |
| 24 | +| `slack:notify:success` | Notify about successful end of deployment. | |
| 25 | +| `slack:notify:failure` | Notify about failed deployment. | |
| 26 | + |
| 27 | +# Available options |
| 28 | + |
| 29 | +| option | default | description | |
| 30 | +| - | - | - | |
| 31 | +| `slack_webhook` | | **(required)** Slack incoming webhook url. | |
| 32 | +| `slack_title` | `{{application}}` | The title of application. | |
| 33 | +| `slack_text` | ``_{{user}}_ deploying `{{branch}}` to *{{target}}*`` | Notification message template, markdown supported. | |
| 34 | +| `slack_success_text` | `Deploy to *{{target}}* successful` | Success template. | |
| 35 | +| `slack_failure_text` | `Deploy to *{{target}}* failed` | Failure template. | |
| 36 | +| `slack_color` | `#4d91f7` | Notification's color. | |
| 37 | +| `slack_success_color` | `{{slack_color}}` | Success' color. | |
| 38 | +| `slack_failure_color` | `#ff0909` | Failure's color. | |
0 commit comments