Create your first HTTP receiver · CronDog

3 min read Original article ↗

A CronDog receiver provides a CronDog hosted API endpoint that allows you to receive HTTP requests, and send email/Slack notifications whenever those requests happen. A CronDog receiver is a handy tool to accept webhooks from web services such as SendGrid and Okta. Or you can simply use it to test and inspect HTTP requests.

In this tutorial, we will show you how to set up a CronDog receiver that sends out email notification when it receives an HTTP request.

After signing into the CronDog dashboard, go to Receivers, and click + New receiver.

A new receiver is created and opens on its detail page.

Under the Receiver Settings section, you can see your receiver's unique URL, which you can use to receive HTTP requests from external resources. The endpoint can receive GET and POST requests.

Click Edit in the Receiver Settings section, and provide the following values:

FieldValueDescription
NameHTTP request receiverThe name of the receiver.
Status Code200The response status code of the endpoint.
Content Typeapplication/jsonThe response content type of the endpoint. The value will appear in response header content-type
Response Body{"message": "Hello World", "requestUserAgent": "${requestHeaders.user-agent}"}The response body of the receiver. You may customize the response body by adding built-in variables such as ${requestBody} and ${requestHeaders}. Variables support JSON path for property value extraction.

Then click Save. With the new settings, the receiver will respond to HTTP callers with a 200 status code, and a JSON formatted response body.

Note that in the response body, we use the built-in variable ${requestHeaders.user-agent} to access the user agent info of the HTTP request. The expression follows JSON path syntax, for more information about built-in variables and JSON path expression, see here.

At this point, you should be able to see the receiver in action. In your web browser, visit your receiver URL: https://crondog.dev/receivers/{receiverId}, then you will see the response:

{
  "message": "Hello World",
  "requestUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
}

Congratulations, your receiver has been configured properly and is actively accepting HTTP requests.

2. Set up notification

Next let us set up an email notification, so we can be notified whenever the receiver gets called.

Under the Notifications section, click Add next to the Email label.

The Add email notification dialog opens.

Enter your email address, and click Save. The new notification appears under the Notifications section.

3. Test task

In your browser, enter your receiver URL again. Shortly after that, you should receive an email triggered by the receiver.

4. Check request history

If you go to the History tab, you can see a history of all HTTP requests that your receiver received.

Here you can check the request details such as request timestamp, request/response body, and request/response headers.

Congratulations! You've successfully set up your first CronDog receiver that accepts HTTP requests publicly, with email notification enabled!