This is a submission for the Postmark Challenge: Inbox Innovators.
What I Built
A fully functional email inbox for the Tape App platform. This template allows Tape power users to manage their email inbox, read HTML emails, reply to emails from respective email records, and most importantly, create advanced automations that adapt to any possible need.
This template leverages all of Postmark's inbound email features by carefully handling In-Reply-To, Message-ID, Postmark Message-ID, From, FromName, HtmlBody, StrippedTextReply, and Attachments.
It also allows you to reply to email messages directly on Tape using the Postmark email/batch endpoint. This endpoint sends the same email to multiple To, Cc, or Bcc with the corresponding Message-ID, In-Reply-To, and References headers. With this endpoint, you can use Postmark tracking webhooks to track delivered, opened, clicked, bounced, and spam for each email message/record on Tape. Lastly, the template uses Postmark Inbound rules triggers to block scam messages by email address.
This template was created for the Tape App platform to act as an email inbox with full customization possibilities to handle email messages based on any parameters.
I’m offering this template for free at the Tape templates library for Tape users. Go to https://templates.tapeapp.com/lp/postmark-inbox-template/r/recH0bfKxuNC5coFI
Please note that to use this template, you need a Tape account: https://go.porfoliowebs.com/tape (Affiliate link. Free 30-day trial of Tape Premium).
Demo
I decided to record a video demonstration to explain how the Postmark API integration works in the Tape platform.
Here is the demo video: https://youtu.be/uHIkA1z112c
Code Repository
To see the code, create a Tape Account (use my affiliate link https://go.porfoliowebs.com/tape for a 30-day free trial of Tape Premium) and then install the template here https://templates.tapeapp.com/lp/postmark-inbox-template/r/recH0bfKxuNC5coFI.
After installing the template, go to Automations > Inbox, and you will see all the automation scripts. The main one is called “Inbound,” which handles all incoming email messages (using the Postmark inbound email parsing feature).
Note that to receive Postmark inbound JSON data, you need to add the Tape webhook URL in the “Set your server’s inbound webhook URL” section of the Postmark inbound stream. You must also set up the inbound email address (I use Cloudflare email routing). You must also add your Postmark API key in the “API” app on Tape to send emails via the /email/batch endpoint.
How I Built It
I built this Postmark/Tape integration because I wanted a fully functional email inbox on Tape that allowed me to receive, send, and reply to emails without leaving Tape. I built a similar integration using another API called “Mailgun,” but it was confusing and frustrating to get it working. Then, I found Postmark API, which finally made it possible to build exactly what I needed (and much more).
The most challenging part of this build was, without a doubt, handling the inbound emails. Luckily, the Postmark inbound API is absolutely fantastic, providing everything I needed to build the integration. I was unaware of how much stuff happens when you receive an email. I based most conditions in the inbound automation on what the Postmark JSON payload returns from the “Headers, In-Reply-To."
Please see the demo video above, where I explain each step in the inbound and other automations in detail. Overall, the conditions compare the “In-Reply-To” against the “References” values and determine whether it is a new or an existing email with a new reply. When an existing email is found in the Tape Inbox app, it will add the new message to the corresponding email record. It also updates the References, last Message ID, and In-Reply-To. These three are crucial because when you reply to the email, you must send them as part of the email headers so the email client can adequately find the correct email and nest the conversations (this took me forever to figure out).
The template also processes the Message ID from Postmark, which is used for the tracking webhooks. During building, that confused me a lot because the Postmark JSON payload gives you two message IDs: the first one is the Postmark MessageID, and the other one (which is in Headers > Name": "Message-ID") is the email message ID.
After setting that up, the inbound messages were processed accordingly. The email conversations are added as Tape record's comments, and replying is handled from the “Email Body Field” under “Compose Email” in the record. Please refer to the video above for a more detailed explanation.
If you have any questions, please add a comment.
Top comments (0)