Notification Tasks Tutorial
In a Hybrik workflow, you can have a task that generates notifications. When your workflow reaches the notification
task, it will trigger the specified notification. Notifications can be one of the following types: email
, REST
, or SNS
. You can have different notification tasks in your workflow to indicate when you have reached different points. For example, you could have one notification task for when a job completes successfully and a different one for when there is an error.
It is important to note that a notification task can only indicate that you have reached a particular point in the workflow. A notification task cannot tell you things like the percentage progress of a job. If you need that type of notification, you can use a system-level SNS notification. Please see the SNS Subscriptions tutorial for more information on how to configure such a notification.
Notification Tasks
The basic structure of a notification
task is as follows
{
"uid": "my_notification_task",
"kind": "notify",
"payload": {
"notify_method": "email",
"email": {
"recipients": "me@mail.com",
"subject": "Notification email",
"body": "This is a notification email"
}
}
}
There is a notify_method
, which may be email
, rest
, or sns
. Inside of the notification, there are a number of placeholders that you can use to indicate the particular job or task. In the Hybrik system, a placeholder is surrounded by a single pair of curly brackets {}
. (See Definitions and Placeholders for a full list.) For example, the job_id
of a job would be referenced as {job_id}
. An error notification email might look like this
Email Notify Task
{
"uid": "qa_error_notification",
"kind": "notify",
"payload": {
"notify_method": "email",
"email": {
"recipients": "{account_owner_email}",
"subject": "QA Error on Job {job_id}",
"body": "There was an error on Job {job_id}."
}
}
}
The same error notification done as a REST call and as an SNS notification is given below.
REST Notify Task
{
"uid": "qa_error_notification",
"kind": "notify",
"payload": {
"notify_method": "rest",
"rest": {
"url": "https://my_rest_entry.example.com?status=error&job_id={job_id}",
"method": "POST"
}
}
}
SNS Notify Task
{
"uid": "qa_error_notification",
"kind": "notify",
"payload": {
"notify_method": "sns",
"sns": {
"topic": "arn:aws:sns:us-east-1:111122223333:my-sns-topic",
"user_payload": "SNS notification: {job_id} had a QA Error"
}
}
}