Notifications
Notifications will send emails to Cloudomation users when executions succeed or abort.
Use Cases
Use notifications to
- Inform Cloudomation users about failing executions.
- Inform Cloudomation users about finished executions.
Concept
The notification feature is implemented as a Wrapper.
Importing the Wrapper bundle will provide you with a wrapper called notify
.
When the notify
wrapper is attached to a flow, it will monitor the execution status of the flow and send a notification on success and/or on error to a list of configured Cloudomation users.
As all wrappers, the notify
wrapper can be statically attached and configured. Please refer to Static Wrappers for more information.
Alternatively, the notify
wrapper can be dynamically attached and configured. Please refer to Dynamic Wrappers for more information.
The most common usage is to statically attach and configure the notify
wrapper to a flow or connector. This way all executions of the flow or connector will notify about an error.
The notify
wrapper provided by Cloudomation is considered an example which can be extended or modified to your needs.
Parameters
The notify
wrapper accepts the following parameters:
Name | Type | Description | Required | Default value |
---|---|---|---|---|
notify_on_success | boolean | If to send a notification when the child succeeds. | no | False |
notify_on_error | boolean | If to send a notification when the child fails. | no | True |
to | list[str] | A list of Cloudomation user names which will be notified. | yes | |
subject | str | The subject line of the notification. Supports several replacement placeholders. | no | {child_name} {child_status} |
body | str | The body of the notification. Supports several replacement placeholders. | no | <p>Execution <a href="{self_url}/execution/{child_id}">{child_name}</a> ended with status <strong>{child_status}</strong></p><pre>{child_message}</pre> |
Replacement Placeholders
Name | Description |
---|---|
child_name | The name of the child execution |
child_id | The ID of the child execution |
child_status | The end status of the child execution |
child_message | The status message of the child execution |
self_url | The URL to the workspace |
Examples
Starting a flow which has the notify
wrapper statically attached
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution):
# we start the flow normally.
# the definition of the flow has the wrapper and its configuration statically attached.
this.flow('<name-of-a-flow>')
return this.success('all done')
Please refer to Wrapper for more information about wrappers and how to statically attach them to resources.
Starting a flow which has the notify
wrapper dynamically attached
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution):
# we start the flow with the notify wrapper dynamically attached and specify the configuration here.
this.using(
'notify',
to=['user1'],
).flow('<name-of-a-flow>')
return this.success('all done')