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.
Create Zap and set up the trigger
Once logged in, click Make a Zap to create a new Zap.
Under Built-in Apps, select Webhooks
Select Catch Hook and click Save + Continue
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 go to Settings > Stream > Webhooks and click Add webhook.
Head back over to Zapier and click Copy to grab the webhook URL for the Zap.
Back in Postmark, 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 Ok, I did this.
You will now see the sample webhook event that was generated and sent to the Zapier webhook url. Click Continue.
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 an Action App, search for Postmark and select it.
Select Send an Email and click Save + Continue.
Click Connect an Account to link your Postmark account to Zapier. Copy your Server API Token from Postmark (in the API Tokens tab) and paste it into the X-Postmark-Server-Token field in Zapier. Then click Yes, 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 Send Test To Postmark button. After testing, click Finish to complete the Zap creation process. Give your Zap a name, turn it on, and rejoice!