How To Turn Parsed Emails in to Webhooks November 2022 · ian
How To Turn Parsed Emails in to Webhooks
We recently launched no-code email parsing as another way to get data into HostedHooks, so if you are interested in consistently turning your emails into structured JSON, you should first check out our post on how to setup email parsing here.
In this post we’re going to assume you've setup your email parsing rules and are successfully turning your emails into JSON. Now we'll go through how to connect your parsed email data with third party services like Slack, Airtable, etc.
Connect your parsed emails to other apps
Assuming you are turning your emails into JSON, it's now time to do something with the data. We will accomplish this using HostedHook’s bread and butter, webhooks .
This next set of steps will turn your email data into webhooks and deliver the data to the third party of your choice (as long as they support inbound webhooks, more on this later).
To get started, head over to your HookHelpers and choose the HookHelper that is currently setup to receive and parse your emails. Once you have a parsed email with JSON output, you will be able to start setting up your webhooks.
Click “Webhooks” to go to your setup page. Let’s go over how to set that up.
Setting up your First Webhook
This next page is where your webhooks will live for this inbox. Each inbox can have multiple outbound webhooks, each with a different destination.
To get started create a new Webhook for this inbox.
Note: To start, all new webhooks are inactive by default, which allows you to build and test before any parsed emails flow through it.
At the top of your webhook page you will find the sample payload that you created with your email parsing rules. This JSON is a sample of the structure that you will be sending as a webhook to third party apps, so you'll need to make sure it is in the correct format for whatever platform you plan on sending it to. Slack for example requires one key named “text” with the value being your message. If you don’t see a payload here, then you skipped a step and need to go back to setting up your parsing rules which we covered here.
This post will go through how to setup a webhook, but in future posts we will show integrations for specific platforms like Slack, Airtable and many others.
If your sample payload looks correct, let’s move on to the next step where we define where we will be sending this data.
Where to send your data
Next we need to define where exactly to send this parsed email data. This is typically defined by a URL or a location on a third party app that is setup to ingest our webhook.
There are two ways to do this. The quick way, which we will cover in this article and the advanced route which will be covered in our documentation. Both setups do the same thing, but the advanced routes give you more flexibility. The advanced route really won’t be necessary for most users, but it is there if you need it.
For the quick setup, we are going to send our parsed emails to ourself to showcase how it all works. We will do this by creating a new HookHelper and use that public URL as the endpoint URL for our Webhook. Let’s get to it.
First step, let’s create a new HookHelper. Open a new tab and head to your HookHelpers index (https://www.hostedhooks.com/hook_helpers). Click “Create a new HookHelper”) and once created grab the url. Keep this tab open, we’ll be using it again shortly.
Now go back to your webhook setup and let’s paste in that url into step 1. It should look something like this.
Hit “Create Endpoint”. Behind the scenes that is creating everything you need to send a webhook. There is a decent amount that goes into it, but we will skip that for the sake of simplicity. Just know that if down the line you want to do something more elaborate, you can because we've generated all the proper records for you.
Now that our endpoint is setup, we can move on to Step 2, which is to send a test message. Go ahead and click “Send a test message”, you should see a success message saying it was queued up. This is an asynchronous process so we'll need to give this a minute or so as it runs through a queue but while we wait, head over to the HookHelper we used as our endpoint URL. In a minute or so, hit refresh and we should see a new request come in.
Click on that request and you will see a test webhook message that was sent through. If everything looks good, you can go ahead and move on to step 3.
In step 3, go ahead and activate your Webhook. Once activated, assuming you have parse rules setup, all new emails will get ingested, parsed and then sent using this webhook. You are essentially done.
Webhook Logs
The last piece is the logs. Each Webhook setup comes with a robust logging system that is extremely helpful for performance insight and debugging. You can view them by clicking on the "Logs" link in the nav.
On this logs page you will be able to review the status of the webhook, the payload that was sent out and even some actions like replay, which are helpful if you want to send the webhooks again.
How Can I Try It Out?
You can sign up for a free account at Hosted Hooks. We provide up to 50 parsed emails a month on the Free Hobby plan which should give you more than enough room to build your parsing rules and test them out. Each email parsing plan also comes with a bucket of webhooks so you can send your parsed emails out to third parties without having to worry about your webhook credits. Remember that this feature is no code ready and does not require a single line of code written.
Conclusion
The goal of this article was to showcase how easy it is to connect your parsed email data with an external source. In our example here we used HookHelpers, but you can replace the HookHelper Endpoint url with any other third party sources like Slack, Airtable, etc. We cover those types of integrations in other posts.
We hope that was helpful and let us know if you have any questions!
Try HostedHooks Free
Getting started is easy! No credit card required.