🪝Webhooks

Webhooks allow you to actively respond to events, from within your own environment.

How webhooks are used

Webhooks are part of triggers. You can set up a webhook endpoint URL for each trigger you've created. Just go to the trigger, edit the trigger and set a webhook endpoint URL. For every event that occurs that fires that trigger, the webhook endpoint URL is called.

Cronly sends an HTTP request with POST data, and JSON contents.

Request to your webhook

You can match the private key within your own webhook to validate the alert is really coming from Cronly. The private key of each trigger can be found inside your trigger details.

Each event can have one of the following statuses.

  • notification This is for certificates only, to inform you of nearly expiring certificates.

  • alert There is a problem with either your cron job or certificate.

  • cleared The existing problem was cleared.

Each event can have one of the following types.

  • cron This event is for a cron job monitor.

  • certificate This event is for an SSL certificate monitor.

The object can be either a cron job or certificate.

Request body example for a cron job

{
  "private_key": "abc847ce-2f24-4c92-99ee-203ccc47d619",
  "event": {
    "id": 1,
    "type": "cron",
    "status": "alert",
    "title": "Test trigger",
    "description": "DEPRECATED",
    "added": "2022-05-30 14:31:22",
    "timezone": "UTC"
  },
  "object": {
    "id": 1,
    "added": "2022-05-30 14:31",
    "project": null,
    "name": "Test",
    "schedule": "* * * * *",
    "previousRun": "2022-05-30 14:42:55",
    "nextRun": null,
    "lastCheck": "2022-05-30 14:42:55",
    "lastPulse": "2022-05-30 14:42:55",
    "timezone": "UTC",
    "status": "alert",
    "archive": false
  }
}

Request body example for an SSL certificate

{
  "private_key": "abc847ce-2f24-4c92-99ee-203ccc47d619",
  "event": {
    "id": 1,
    "type": "certificate",
    "status": "healthy",
    "title": "Test trigger",
    "description": "DEPRECATED",
    "added": "2022-05-30 14:31:22",
    "timezone": "UTC"
  },
  "object": {
    "id": 1,
    "added": "2022-05-30 14:28:32",
    "project": null,
    "hostName": "cronly.app",
    "port": 443,
    "lastCheck": "2022-05-30 14:28:32",
    "status": "valid",
    "archive": false
  }
}

Expected response

Successful response

We wait for a response from your webhook and fetch and store the response for you to review. The response should have a 200 OK HTTP response, if everything works as expected. We store your complete response.

Error response

Any other response code will be interpreted as an error. Cronly sends out an e-mail notification to all email addresses related to the trigger. You can review the response in Cronly.

Last updated