Overview

DBSync Cloud Replication provides a new notification system named Webhooks which enables the user to be updated with all events or activities that are done in the profile which includes immediate notification on the company’s server or on any other communication system such as Slack etc which the organisation is using. The notifications alerts can be activated for various activities/logs such as when a process has started, is in progress or any error notification. The organization will be notified through GET or POST API’s

Problem Statement

Organisations using DBSync Cloud Replication might find it hard to keep track of the various processes in progress or errors that might have occurred during the progress. Email notifications for when a process is complete is currently provided as an in-built feature but might not be sufficient to keep track of errors, or start, and finish of a process. Also receiving notification within the server of the company or any communication channel such as Slack can be extremely beneficial to the users to keep track of all events. Will also enables the user to do any kind of processing when a command is running in DBSync Cloud Replication. It is also very essential for the user to be notified about the three most important stages of an activity:

  1. When the Job is started 

  2. When the Job is completed 

  3. When there is an error

Webhooks notification system solves these issues to the users and makes the process of keeping track of the various events much easier. 

Setting up of Webhooks

To set up webhooks:

    1. Started

    2. Completed

    3. Errored

  1. GET method:


Method: GET

https://backupreport.hejuba.ch/api.php?computername=CTCSRV20&datetime=$date;

  format =”yyyy-MM-dd’T’hh:mm:ss”$&profile=$profile$&errorCount=$if(isError)$$errorCount$$else$0$endif$&recordProcessed=$recordsProcessed$

 

Computer name, date, time, profile details, error count and number of records processed

b. POST method:

For example:

Let us consider that a user wants to get notified in SLACK. 

Enter details as follows:

  1. URL:


Slack

POST 

URL: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX


  1. Content Type:


Content-type:

Content-type: application/json


  1. Payload:


Payload: (Freeform)

{

“text” : ” event=$event$ date=$date; format =”yyyy-MM-dd’T’hh:mm:ss”$ ”

}




date, time, profile and error.

In this manner the user can define their own Payload and provide the parameters in the standard expressions format with/without conditions to receive the respective POST notifications in their communication channel such as in this case SLACK.

NOTE:

Type: Started, Stopped, Errored

DateTime: Ability to convert into the timezone they want

This can leverage SimpleDateTimeFormat in Java

Records processed : If Error, the error message and Error code

Erroring on the post event should still continue the processing, we need to add it to logs as SEVERE error and email if there is a notification email attached.

  1. Headers - textarea ( multiple lines, each line is a separate header) - notification.webhook.header

  2. Content-Type - text - notification.webhook.content-type

  3. Payload (supporting variable injection) -using Code Editor notification.webhook.post.body

Supported Expressions:

Option

Expression

Notes

Current date

$date; format=”dateformat”$

Format is an optional attribute. However, it is recommended to add one.

Do NOT escape quotes in dateformat as it can lead to errors.

Current event

$event$

Values: Started, Errored or Completed

Error count

$errorCount$

Denotes the number of objects that encountered an error

Is error in backup

$isError$

Values: true if event is errored else false

Profile Name

$profile$


Total records processed

$recordsProcessed$

Total number of records processed ie. inserted + updated for all objects

Using Conditions:

If else conditions are supported, however we need to specify boolean variable from the supported list for conditions:

Syntax:

$if(variable1)$value1$elseif(variable2)$value2$else$value3$endif$

Example

$if(isError)$$errorCount$$else$0$endif$