Hookdeck

platforms | Dec 8, 2022

How to Solve SendGrid's One Webhook URL Limit

Profile Picture

Eric Tran

SendGrid’s Event Webhook only allows for one webhook URL. However, you may want your webhooks to go to multiple services, for example email analytics on top of your servers.

In this article, I’ll explain how to bypass this limitation by duplicating and routing webhooks within Hookdeck.

How to add Hookdeck’s webhook URL on SendGrid

  1. Copy the source URL in Hookdeck. Copy Hookdeck URL screenshot

  2. Paste the source URL in SendGrid. Add webhook URL on SendGrid screenshot

  3. Click Save.

  4. Confirm Hookdeck receives SendGrid event webhooks.

How to duplicate webhooks with Hookdeck

Great! Now that you are receiving SendGrid’s webhook in Hookdeck, we’ll take advantage of the fanning-out behavior. To duplicate (or fan-out) the webhook to a second destination, follow the steps outlined below.

  1. Create a new Connection with the same source.
  2. Trigger an Event to validate that the webhook was duplicated.

But what if you only want specific webhooks to reach a connection?

How to route webhooks with Hookdeck

By adding a filter (conditional logic in JSON), you can define the criteria and choose which webhooks will be delivered to a connection.

Example: Filter SendGrid webhooks based on status

Lets say you only want webhooks with the status “cancelled” delivered to your analytics connection. You will add this JSON as a filter to your connection for the following payload.

Hookdeck filter:

JSON
[
  {
    "event": "cancelled"
	}
]

SendGrid webhook payload:

JSON
[
  {
    "email": "[email protected]",
    "timestamp": 1669193462,
    "smtp-id": "<[email protected]>",
    "event": "processed",
    "category": [
      "cat facts"
    ],
    "sg_event_id": "r4EQlb4UpE6iho4_z-RmLQ==",
    "sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"
  }
]

Hookdeck walkthrough:

Conclusion

In this article, you learned how to bypass SendGrid’s one webhook URL limitation. With Hookdeck we were able to use one webhook URL, and then duplicate and route webhooks to fit our use case.

With Hookdeck’s transformations, you can even change the payload before arriving to your destination! Read the docs here.

Transformations overview

Step by step how to set up Hookdeck.

Try Hookdeck Today

Instantly & reliably manage
your webhooks

Learn More