Back to Deployer

Ms-teams Recipe

docs/contrib/ms-teams.md

8.0.33.9 KB
Original Source
<!-- DO NOT EDIT THIS FILE! --> <!-- Instead edit contrib/ms-teams.php --> <!-- Then run bin/docgen -->

Ms-teams Recipe

php
require 'contrib/ms-teams.php';

Source

Installing

Require ms-teams recipe in your deploy.php file: Setup:

  1. Open MS Teams
  2. Navigate to Teams section
  3. Select existing or create new team
  4. Select existing or create new channel
  5. Hover over channel to get three dots, click, in menu select "Connectors"
  6. Search for and configure "Incoming Webhook"
  7. Confirm/create and copy your Webhook URL
  8. Setup deploy.php Add in header:
php
require 'contrib/ms-teams.php';
set('teams_webhook', 'https://outlook.office.com/webhook/...');

Add in content:

php
before('deploy', 'teams:notify');
after('deploy:success', 'teams:notify:success');
after('deploy:failed', 'teams:notify:failure');

9.) Sip your coffee

Configuration

  • teams_webhook – teams incoming webhook url, required
    set('teams_webhook', 'https://outlook.office.com/webhook/...');
    
  • teams_title – the title of application, default {{application}}
  • teams_text – notification message template, markdown supported
    set('teams_text', '_{{user}}_ deploying `{{what}}` to *{{where}}*');
    
  • teams_success_text – success template, default:
    set('teams_success_text', 'Deploy to *{{where}}* successful');
    
  • teams_failure_text – failure template, default:
    set('teams_failure_text', 'Deploy to *{{where}}* failed');
    
  • teams_color – color's attachment
  • teams_success_color – success color's attachment
  • teams_failure_color – failure color's attachment

Usage

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

php
before('deploy', 'teams:notify');

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

php
after('deploy:success', 'teams:notify:success');

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

php
after('deploy:failed', 'teams:notify:failure');

Configuration

teams_title

Source

Title of project

php
return get('application', 'Project');

teams_failure_continue

Source

Allow Continue on Failure

php
false

teams_text

Source

Deploy message

php
'_{{user}}_ deploying `{{what}}` to *{{where}}*'

teams_success_text

Source

php
'Deploy to *{{where}}* successful'

teams_failure_text

Source

php
'Deploy to *{{where}}* failed'

teams_color

Source

Color of attachment

php
'#4d91f7'

teams_success_color

Source

php
'#00c100'

teams_failure_color

Source

php
'#ff0909'

Tasks

teams:notify {#teams-notify}

Source

Notifies Teams.

teams:notify:success {#teams-notify-success}

Source

Notifies Teams about deploy finish.

teams:notify:failure {#teams-notify-failure}

Source

Notifies Teams about deploy failure.