The web and mobile are both moving much more real-time, with push notifications and auto-updating interfaces. Yet, most APIs that tie together our technology are “pull” technology. You make a request and get back a result. Webhooks are one of the popular answers to providing data as-needed. At SendGrid we have two webhooks, one for events and another for incoming email. You can do some cool things with these webhooks. If you look around, you’ll find other companies that also use this technology to provide real-time access to events as they occur. But what do you do with those webhooks once you have them? Here are four ideas.
Test Them Simply in Your Terminal
Our simple webhook debugger can very quickly show you what the data looks like. Visit the page, get a webhook URL. Plug that into any service that produces a webhook, copy-paste a cURL command to your terminal and inspect data as it arrives.
Wire Them to Your Local App
When you’re ready to pipe that data stream into your app, use a tool like ngrok to get the data to your local development environment. Developer Evangelist Martyn Davies wrote a post on using ngrok with SendGrid webhooks.
Connect Them to Other Services
If you want to take the data from a webhook and do something simple, you may not even need to write code. I have been calling this concept un-programming and it’s embodied in a service called Zapier, which connects to a bunch of different apps. In my recent SXSW workshop I showed how to connect SendGrid click events using Zapier’s SendGrid and webhook apps.
Duplicate and Reflect Them
What happens when you want to send your webhook to multiple destinations? SendGrid Labs has a new service in beta called Reflector that does just that. It’s also a useful tool for logging and debugging webhooks.
If you’d like a look closer at fun use cases of SendGrid’s webhooks, download the free Parse Webhook Guide.