API Webhooks Made Easy with Email Subdomains

API Webhooks Made Easy with Email Subdomains

Subdomains are a bit of an underutilized feature of the web. What first comes to mind is splitting website names for specific purposes or teams. But they can also serve an advantageous role during testing and development.

Subdomains can:

  • Isolate different application environments across your team
  • Allow developers to create ad-hoc inboxes per application
  • Make it easy to stitch together different services together

In this article, we'll focus on how you can take advantage of subdomains to pipe data to a different site.

No alt text provided for this image

Using Emails to Start API Calls

Let's work through a scenario. We want a way for another group, say the Operations team, to alert our development team about critical issues in production. Emails alone don't quite work since we receive a deluge of emails daily. Slack also doesn't work since we want this message to always ping us. Installing a whole ticket system for this seems a bit heavy-handed.

One easy solution, and the one we'll focus on for the rest of this article, is email forwarding to slack.

Here's the series of events we should be able to accomplish:

  1. An email hits one of our specific inboxes in a subdomain.
  2. A webhook service then fires off to Slack.
  3. Slack will send us a notification alerting us that our production app took a nosedive and they can't figure out why.
No alt text provided for this image

Here's where we mention our plug: You can use mailsac to do all this. You don't need to sign up for 2-3 different services and you don't need your IT team's help. You can signup for a subdomain, a recipient inbox, and a webhook target in under 20 seconds.

Diving Right In

The Subdomain

We'll use mailsac's Zero Setup Subdomain service to register services-acme.msdc.co. You also have the option to bring your own domain. Keep in mind that you will need at least an Indie Plan to do the scenario outlined in this article.

No alt text provided for this image

The Inbox

Use the mail checker field in the top left to create [email protected]. Mailsac creates these inboxes automatically whenever you type a name in.

After creating the inbox on demand, hit the Make this Inbox Private button. Finally, hit Reserve & Configure to have a dedicated inbox ready to start receiving emails.

No alt text provided for this image

The Webhook

For this section, I'll go ahead and assume you have a slack app set up on your slack app or channel. If not, I highly recommend setting one up using our Create Slack Application guide.

For mailsac's purposes, you'll just need the target webhook under the Add Features & Functionality->Incoming Webhooks section of Slack. You can find the URL under Webhook URLs For Your Workspace.

No alt text provided for this image

Copy that URL to the dedicated Forward To Slack section

No alt text provided for this image

Test Spin

Testing the integration is easy. Fire up your email client:

No alt text provided for this image

And hit send. You should see your alert in the slack channel configured by your app:

No alt text provided for this image

And that's it!

Wrapping Up

We gave you just a taste of how subdomains can differentiate between API endpoints during your development. There's many other scenarios we've outlined including how to use subdomains across your entire organization in our full article "Own Your Testing Workflow". We also discuss how individual developers can integrate subdomains with email testing.

Thanks for reading, until next time!

要查看或添加评论,请登录

Mailsac的更多文章