Overview

Mitto Webhooks can request data from or send data to any URL when a job starts, completes, succeeds, or fails.

Webhooks can be added to any individual job or sequence in Mitto.

Add a Webhook to a Job

Click the edit button in the Webhooks section of any job.

Fill in the form.

URL

The URL to send the GET or POST request to.

Event

Webhooks can be initiated from four different job event types:

  • JOB_START - initiate the webhook when the job starts
  • JOB_COMPLETE - initiate the webhook when the job completes
  • JOB_SUCCESS - initiate the webhook if the job succeeds
  • JOB_FAILURE - initiate the webhook if the job fails

Method

  • GET - request data from the URL
  • POST - send data to the URL

Typically, you want to send data to another application via a POST.

Content Type

This is the format of the body of the request.

  • application/json
  • application/x-www-form-urlencoded
  • text/plain

The choice here depends on the data format the URL is expecting.

Body

This is the body of the request.

Editing an existing Webhook

Click the edit icon next to any existing Webhook to edit the Webhook.

Multiple Webhooks on the same Job

Multiple webhooks can be added to any job in Mitto, enabling complex use cases.

Webhooks Data

Data from the Mitto API can be sent in the body of a Webhook.

You can see the available data in the Mitto API endpoints:

Endpoint: {mitto_url}/api/job/{job_id}

Endpoint: {mitto_url}/api/system

Simple examples:

  • ${job['title']} translates to "Webhooks!"
  • ${system['fqdn']} translates to "stage.zuarbase.net"

Complete example:

This example sends text to a Slack channel.

{ 
  "text": "Job Complete!: ${system['fqdn']} - ${job['title']}\nhttps://${system['fqdn']}/#!/job/${job['id']}" 
}

This webhook body translates to:

Job Complete!: stage.zuarbase.net - Webhooks!
https://stage.zuarbase.net/#!/job/22739

Webhooks that interact with Mitto

You can create Webhooks that interact directly with Mitto itself.

For example, one job's webhook can start another job:

Notice the URL:

http://localhost:7127/v2/jobs/<job_id>/:actions

And the body:

{
   "action": "START"
}