Using Zapier Webhooks to Notify Senders of Bounces
Your users will typically want to know when an email they send bounces so that they can get an accurate email address for their recipient or contact them through another channel. Postmark’s bounce webhooks provide a way to receive notifications when these events occur but do require some development work to set up and use effectively.
An alternative to developing your own code for receiving and using Postmark webhook events is to use Zapier’s webhooks. In this help article we will show you how to set up a Zap to notify your users of bounces by automatically sending them an email (also using Postmark) with the bounce details.
If you don’t already have a Zapier account, you can sign up here.
*Note: Zapier requires that you be on one of their paid plans in order to use Webhooks by Zapier.
Create Zap and set up the trigger
Once logged in, hover over the + button on the left-hand side and click Make a Zap to create a new Zap.
Under Built-in Apps, select Webhooks by Zapier
Under Choose Trigger Event select Catch Hook and then the Continue button
Click Copy to grab the webhook URL for the Zap. You won’t be picking off a child key, so leave that field blank and click Continue
Now you will need to log into your Postmark account. Once logged in, navigate to your Postmark server and select your Stream. From there click Webhooks and then Add webhook
Paste the URL into the Webhook URL field. Select Bounce under “Which events should we send?”. Next to “Test your webhook URL” select Bounce in the dropdown and then click Send Test. Send test will generate a sample bounce webhook event and send it to your Zap’s webhook URL. We will use this sample data to set up the email notification that will head to your users when an email they send bounces.
Scroll down and select Save webhook to save the webhook settings in Postmark.
Head back to Zapier and click Test and Continue. You can review the sample data first if you’d like, although this isn’t necessary.
Set up the Zap’s Postmark action
Now that our zap is successfully set up to receive webhooks from Postmark when an email bounces, we can set it up to send an email with the bounce details to the sender.
Under Choose App & Event, search for Postmark and select it.
Under Choose Action Event select Send an Email and click Continue
Click Sign in to Postmark to link your Postmark account to Zapier
Pop back over to Postmark and copy your Server API Token (in the API Tokens tab) and paste it into the X-Postmark-Server-Token field in Zapier. Then click Yes, Continue.
Click Continue.
In the From Email Address field, enter in the address you want the notifications of bounces to be sent from. Be sure to use an address that is a confirmed Sender Signature on your Postmark account or is on a domain that you have verified.
In the To Email Address field, select the From field from our Catch hook we set up previously.
With the email set up to be sent to the sender of the email that bounced, you can now configure the subject of the notification and its content. What you use here is up to you, but here is how we recommend setting it up.
For the email subject, use “Bounce received from [recipient]”. To do this, type in Bounce received from and then select Email from the Catch hook field choices.
Which will look like this after selecting Email:
Now you can enter in the details you want to include in the content of the email sent to the sender letting them know about the bounce. Here is what we recommend using from the bounce webhook event:
Once you have filled these in for the Text Email Body and HTML Email body fields for the Zap, click Continue.
You can now review how your email will look and can try out a test using the Test and Continue button. After testing, click Done Editing.
Pss! Don’t forget to give your Zap a name, turn it on, and rejoice!