Create a SendGrid Event Webhook receiver
You can create a CronDog receiver to receive SendGrid Event Webhooks, and send email/Slack notifications whenever a SendGrid event is fired.
1. Create receiver
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 the receiver's unique URL, which you will use to receive SendGrid events. The endpoint accepts GET and POST requests.
Click Edit in the Receiver Settings section, and provide the following values:
| Field | Value | Description |
|---|---|---|
| Name | SendGrid webhook receiver | The name of the receiver. |
| Status Code | 200 | The response status code of the endpoint. |
| Content Type | text/plain | The response content type of the endpoint. The value will appear in response header content-type |
| Response Body | The response body to be sent back to SendGrid. You may leave this field as empty. |
Then click Save. With the new settings, the receiver will respond to HTTP callers (SendGrid) with a 200 status code and empty response body.
2. Set up notification
Next let us set up an email notification, so we can be notified whenever the receiver gets a SendGrid event.
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.
Note that in the message template, you can use JSON path expression to extract desired objects/properties in ${requestBody}, e.g. ${requestBody[0]}.
3. Register a SendGrid Event Webhook
Now you can register your receiver URL in your SendGrid account. Go to your SendGrid Event Webhook setting page (Settings -> Mail Settings -> Event Webhook), provide the following values:
| Field | Value | Description |
|---|---|---|
| Authorization Method | None | No authorization method. |
| HTTP Post URL | https://crondog.dev/receivers/{your-receiver-unique-id} | The CronDog receiver URL. |
| Deliverability Data | Dropped and Bounced | Tells SendGrid to notify the CronDog receiver whenever a SendGrid email delivery is dropped or bounced. |
Then click Test Your Integration, you should receive an email that contains the test data generated by the SendGrid event webhook.
Finally, toggle the SendGrid Event Webhook status to ENABLED, and click Save.
Congratulations! You've successfully created a receiver that accepts SendGrid Event Webhooks, with email notification enabled!
