1. Create a slack incoming webhook to your preferred slack channel with the following guide: Slack Webhooks

A. Create a Slack App

Specify the name and choose the Slack Workspace where the notification will be sent.

B. Under the Add features and functionality section, click on Incoming Webhooks and activate Incoming Webhooks.

C. Add New Webhook to Workspace and select which channel on your workspace you would like to send the notifications to.

   2.   Create a bash script to send a webhook notification on your channel and copy the Webhook URL from the Slack App we just created into the SLACK_WEBHOOK_URL portion of the script.

Make sure that your script has the appropriate executable permission (chmod +x /path/to/script.sh)


SLACK_WEBHOOK_URL=https://slack.com ## Set the WEBHOOK URL HERE

declare -A param
while IFS='=' read -r -d '&' key value; do
        [[ -z "$key" ]] && continue;
done <<<$(cat)"&"

###Slack Section Template###
        "type": "section", 
        "text": { 
            "type": "mrkdwn", 
            "text": "__MESSAGE__" 


addSection() {
    [[ "" != "$SECTIONS" ]] && _S=","    
    SECTIONS+=${_S}$( echo "$SECTION_TPL" | sed "s/__MESSAGE__/${_MSG}/" )    

    case "${param[status]}" in      
        STATUS='Partially Completed'

case "${param[stage]}" in 
        addSection "Backup Job (${JOB_NAME}) Started at ${CURRENT_DATE}"

        addSection "Backup Job (${JOB_NAME}) Finished at ${CURRENT_DATE}"
        addSection "Backup Status: ${STATUS}"

SLACK_MSG='{"text": "Jetbackup Slack Notification", "blocks": ['"${SECTIONS}"']}'
curl -X POST -H 'Content-type: application/json' --data "${SLACK_MSG}" "${SLACK_WEBHOOK_URL}"


3.   Create a JetBackup Pre and Post Backup Job Hook and specify the path to your slack script.

WHM > JetBackup > Hooks > Create New Hook:

  1. Hook Name: pre-Backup slack notification/post-Backup slack notification
  2. Hook Position: pre/post
  3. Hook Type: Backup
  4. Backup Jobs: {Specify your preferred backup jobs or leave blank to apply for all backup jobs}
  5. Hook Script: {Path to the bash script from Part 2}

4. Start Getting Notifications!

Once your Hooks are set up, you will start receiving notifications on the slack channel depending on your script and hook type. In this case, sending notifications for when a backup starts and finishes and the corresponding status of the backup job.

Further Reading:

JetBackup has additional hook types available for your use.

Feel free to modify the slack notification bash script in part 2 for additional notifications like getting specific alerts for failed accounts, or when a restore or download was successful.

You could also add customizations and advanced formatting to your slack notification layout with the use of slack’s text formatting and Block Kit.