Sends a custom notification to Teams.
You can configure Teams integration for your repository to get notifications on standard events, such as build failures and deployments. Use this pipe to send your own additional notifications at any point in your pipelines.
Add the following snippet to the script section of your bitbucket-pipelines.yml file:
- pipe: e210/teams-notify:0.1.0
variables:
WEBHOOK_URL: '<string>'
# MESSAGE: '<string>' # Optional.
# TITLE: '<string>' # Optional.
# PAYLOAD_FILE: '<string>' # Optional.
# DEBUG: '<boolean>' # Optional.| Variable | Usage |
|---|---|
| WEBHOOK_URL (*) | Incoming Webhook URL. It is recommended to use a secure repository variable. |
| MESSAGE (1) | Notification attachment message. Required unless PAYLOAD_FILE is used. |
| TITLE | Notification pretext. Default: Notification sent from <a href='https://bitbucket.org'>Bitbucket</a>. Used with MESSAGE. Required unless PAYLOAD_FILE is used. |
| PAYLOAD_FILE(1) | Path to JSON file containing custom payload. Required unless MESSAGE are used. |
| DEBUG | Turn on extra debug information. Default: false. |
(*) = required variable. (1) = required variable. Required one of the multiple options.
To send notifications to Team, you need an Incoming Webhook URL (Teams integration).
Basic example:
script:
- pipe: e210/teams-notify:0.1.0
variables:
WEBHOOK_URL: $WEBHOOK_URL
MESSAGE: 'Hello, world!'Advanced example:
If you want to pass complex string with structure elements, use double quotes
script:
- pipe: e210/teams-notify:0.1.0
variables:
WEBHOOK_URL: $WEBHOOK_URL
MESSAGE: '"[${ENVIRONMENT_NAME}] build has exited with status $build_status"'Use custom payload and modify payload with the envsubst program that substitutes the values of environment variables:
script:
- envsubst < "payload.json.template" > "payload.json"
- pipe: e210/teams-notify:0.1.0
variables:
WEBHOOK_URL: $WEBHOOK_URL
PAYLOAD_FILE: payload.jsonIf you're reporting an issue, please include:
- the version of the pipe
- relevant logs and error messages
- steps to reproduce
Copyright (c) 2024 Ezio Caffi. Apache 2.0 licensed, see LICENSE.txt file.
For more information, visit the repository on Bitbucket.