One of the guiding principles of the Postmark product is that as a platform we want to be easy to integrate with, but powerful enough to run extremely sophisticated infrastructure if our customers need it. We are constantly expanding the ways you can make Postmark part of your app’s workflow. Most recently we introduced modular webhooks, and today we’re releasing another improvement to how you send and interact with your emails: the ability to add and retrieve custom metadata for the emails you send through Postmark.
We know from feedback and customer interviews that many of you need a way to identify the emails you send throughout their lifecycle. This means you need to keep track of each email not just as it flows through Postmark, but outside of it as well. We also know that you can’t always rely only on the Postmark-generated Message ID to accomplish this — you need a way to set your own unique IDs on a per-message basis. And that’s where custom metadata comes in.
As an example, let’s say that you’d like to update your users in real-time on the delivery status of invoice emails that they’ve sent. The best way to do this would be to attach a unique User ID and Invoice Number to each email. When an email is opened or clicked you could then associate it with your records, and show your users that the invoice has been delivered, opened, bounced, etc.
Custom metadata lets you do this. Here’s what we’re adding with this release:
- You can assign custom metadata to each email you send, using the API or SMTP. This metadata is not included in the email content, so recipients will not see the data you add.
- This metadata is retrievable through the Messages API. When a message is returned via the Messages API, the metadata you added will be returned with it.
- Even more importantly, the metadata you added will be included when you receive a webhook related to the message. If, for example, you get a bounce webhook, you’d be able to match that back with any custom identifiers you have on your end.
- The metadata you sent will also be viewable on the Message Detail page inside the Postmark UI.
- When searching for outbound messages using the Messages API, you can filter by metadata value using additional GET query parameters. This will narrow down the search to only messages that have the metadata name with the given value. Important: It is not currently possible to search for messages by metadata value in the Postmark UI. This is an API-only feature for now. We will add search in the Postmark UI in an upcoming release.
- Let’s talk about limits! You can associate up to 10 metadata fields per message. The field name is limited to 20 characters, while the field value itself is limited to 80 characters. Based on our research we haven’t found any scenario where these limits would present a problem, but please let us know if you have a use case that’s not accounted for with these limits.
We’re really excited about bringing you this change to help make your integration with Postmark more customizable and powerful. As always, we’d love to hear your feedback, so please email us at email@example.com if you have any thoughts or comments.