From 00a1510a0c6ded87c605d651b5f3912d4c3306da Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Mon, 15 Jun 2026 13:44:38 +0200 Subject: [PATCH 1/2] Add ms-teams-workflows --- contrib/ms-teams-workflows.php | 157 +++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 contrib/ms-teams-workflows.php diff --git a/contrib/ms-teams-workflows.php b/contrib/ms-teams-workflows.php new file mode 100644 index 000000000..91c06d02f --- /dev/null +++ b/contrib/ms-teams-workflows.php @@ -0,0 +1,157 @@ +jsonBody([ + 'text' => get('teams_workflows_text'), + ])->send(); + } catch (\Exception $e) { + if (get('teams_workflows_failure_continue', false)) { + warning('Error sending Teams Workflows Notification: ' . $e->getMessage()); + } else { + throw $e; + } + } +}) + ->once() + ->hidden(); + +desc('Notifies Teams (Workflows) about deploy finish'); +task('teams-workflows:notify:success', function () { + if (!get('teams_workflows_webhook', false)) { + warning('No MS Teams Workflows webhook configured'); + return; + } + + try { + Httpie::post(get('teams_workflows_webhook'))->jsonBody([ + 'text' => get('teams_workflows_success_text'), + ])->send(); + } catch (\Exception $e) { + if (get('teams_workflows_failure_continue', false)) { + warning('Error sending Teams Workflows Notification: ' . $e->getMessage()); + } else { + throw $e; + } + } +}) + ->once() + ->hidden(); + +desc('Notifies Teams (Workflows) about deploy failure'); +task('teams-workflows:notify:failure', function () { + if (!get('teams_workflows_webhook', false)) { + warning('No MS Teams Workflows webhook configured'); + return; + } + + try { + Httpie::post(get('teams_workflows_webhook'))->jsonBody([ + 'text' => get('teams_workflows_failure_text'), + ])->send(); + } catch (\Exception $e) { + if (get('teams_workflows_failure_continue', false)) { + warning('Error sending Teams Workflows Notification: ' . $e->getMessage()); + } else { + throw $e; + } + } +}) + ->once() + ->hidden(); From 29769458b76946550545b6a1c0a42ddfa8924346 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Mon, 15 Jun 2026 13:45:42 +0200 Subject: [PATCH 2/2] Update Docs --- docs/contrib/README.md | 1 + docs/contrib/ms-teams-workflows.md | 154 +++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 docs/contrib/ms-teams-workflows.md diff --git a/docs/contrib/README.md b/docs/contrib/README.md index c75174196..44faf7be9 100644 --- a/docs/contrib/README.md +++ b/docs/contrib/README.md @@ -15,6 +15,7 @@ * [Ispmanager Recipe](/docs/contrib/ispmanager.md) * [Mattermost Recipe](/docs/contrib/mattermost.md) * [Ms-teams Recipe](/docs/contrib/ms-teams.md) +* [Ms-teams-workflows Recipe](/docs/contrib/ms-teams-workflows.md) * [Newrelic Recipe](/docs/contrib/newrelic.md) * [Npm Recipe](/docs/contrib/npm.md) * [Ntfy Recipe](/docs/contrib/ntfy.md) diff --git a/docs/contrib/ms-teams-workflows.md b/docs/contrib/ms-teams-workflows.md new file mode 100644 index 000000000..b776f931a --- /dev/null +++ b/docs/contrib/ms-teams-workflows.md @@ -0,0 +1,154 @@ + + + + +# Ms-teams-workflows Recipe + +```php +require 'contrib/ms-teams-workflows.php'; +``` + +[Source](/contrib/ms-teams-workflows.php) + + + +## Installing +Microsoft is retiring the legacy "Incoming Webhook" connector. New +integrations must use the **Workflows** app (Power Automate). This +recipe targets the Workflows "Post to a channel when a webhook request +is received" template. +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. Click the three dots on the channel, choose "Workflows" +6. Pick the template **Post to a channel when a webhook request is received** +7. Follow the wizard, then copy the generated HTTPS POST URL +8. Setup deploy.php + Add in header: +```php +require 'contrib/ms-teams-workflows.php'; +set('teams_workflows_webhook', 'https://prod-XX.westeurope.logic.azure.com:443/workflows/...'); +``` +Add in content: +```php +before('deploy', 'teams-workflows:notify'); +after('deploy:success', 'teams-workflows:notify:success'); +after('deploy:failed', 'teams-workflows:notify:failure'); +``` +9.) Sip your coffee +## Configuration +- `teams_workflows_webhook` – workflow HTTPS POST URL, **required** + ``` + set('teams_workflows_webhook', 'https://prod-XX.westeurope.logic.azure.com:443/workflows/...'); + ``` +- `teams_workflows_title` – the title of application, default `{{application}}` +- `teams_workflows_text` – notification message template + ``` + set('teams_workflows_text', '_{{user}}_ deploying `{{what}}` to *{{where}}*'); + ``` +- `teams_workflows_success_text` – success template, default: + ``` + set('teams_workflows_success_text', 'Deploy to *{{where}}* successful'); + ``` +- `teams_workflows_failure_text` – failure template, default: + ``` + set('teams_workflows_failure_text', 'Deploy to *{{where}}* failed'); + ``` +- `teams_workflows_failure_continue` – if `true`, errors talking to the + workflow endpoint are downgraded to warnings instead of aborting the + deploy. Default `false`. +## Usage +If you want to notify only about beginning of deployment add this line only: +```php +before('deploy', 'teams-workflows:notify'); +``` +If you want to notify about successful end of deployment add this too: +```php +after('deploy:success', 'teams-workflows:notify:success'); +``` +If you want to notify about failed deployment add this too: +```php +after('deploy:failed', 'teams-workflows:notify:failure'); +``` + + +## Configuration +### teams_workflows_title +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams-workflows.php#L81) + +Title of project + +```php title="Default value" +return get('application', 'Project'); +``` + + +### teams_workflows_failure_continue +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams-workflows.php#L86) + +Allow Continue on Failure + +```php title="Default value" +false +``` + + +### teams_workflows_text +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams-workflows.php#L89) + +Deploy message + +```php title="Default value" +'_{{user}}_ deploying `{{what}}` to *{{where}}*' +``` + + +### teams_workflows_success_text +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams-workflows.php#L90) + + + +```php title="Default value" +'Deploy to *{{where}}* successful' +``` + + +### teams_workflows_failure_text +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams-workflows.php#L91) + + + +```php title="Default value" +'Deploy to *{{where}}* failed' +``` + + + +## Tasks + +### teams-workflows\:notify {#teams-workflows-notify} +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams-workflows.php#L94) + +Notifies Teams (Workflows). + + + + +### teams-workflows\:notify\:success {#teams-workflows-notify-success} +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams-workflows.php#L116) + +Notifies Teams (Workflows) about deploy finish. + + + + +### teams-workflows\:notify\:failure {#teams-workflows-notify-failure} +[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams-workflows.php#L138) + +Notifies Teams (Workflows) about deploy failure. + + + +