Postmark Batch API - Send unique email to each recipient

Update: Server token question resolved.

Hi all, looking for a bit of assistance with the Postmark API.

I have an API call set up the on the batch endpoint (https://api.postmarkapp.com/email/batch), the purpose of which, is to send marketing emails to a list of contacts via a Broadcast stream.

I’m trying to work out two things:

  1. How do I ensure that each person receives their own unique email (complete with the merge tag).

  2. Is there a way I can dynamically pass the server token to the API? I need to be able to set up unique servers in postmark (one for each customer), and ensure that the emails for my customer go through the correct streams.

Here’s how the workflow is currently set up:

And here is the API call:

Really appreciate any help!

you can definatly create server, for each of your user, and also create template for them

create server: Servers API | Postmark Developer Documentation

create template for each server usign server api token unique to that server and also passing html , HtmlBody paramter for server whcih contain the html code and merge tags: Templates API | Postmark Developer Documentation

The questio , Is there a way i can dynamically pass the verser token to api is yes you can, just make the api token parameter of each call public this way you can dynamically pass the server token related to user.

but you have to setup API call, dont use any plugin else you be dependent to its creator, and also cant tweak the call to your need.

Actually just figured out the server token part - thanks! Still need to figure out how to pull through all the recipients and send a unique email for each one.

i’m working on the same objective. so far you’re way ahead of me.

You can reference this payload in the Postmark Batch API documentation. You can customize the “To” email and insert the proper merge tag via the “TextBody” and “HtmlBody”

[
  {
    "From": "sender@example.com",
    "To": "receiver1@example.com",
    "Subject": "Postmark test #1",
    "TextBody": "Hello dear Postmark user.",
    "HtmlBody": "<html><body><strong>Hello</strong> dear Postmark user.</body></html>",
    "MessageStream": "outbound"
  },
  {
    "From": "sender@example.com",
    "To": "receiver2@example.com",
    "Subject": "Postmark test #2",
    "TextBody": "Hello dear Postmark user.",
    "HtmlBody": "<html><body><strong>Hello</strong> dear Postmark user.</body></html>",
    "MessageStream": "outbound"
  }
]

I got that far - my question was how to populate each one of those with data.

I’ve done it via “workflow on a list” now anyway and it works as needed.

I do this with a looping backend workflow and it uses the broadcast stream for each message. Each one is unique, in that it follows a template but the contents is tailored for each user. Perhaps I should make it more advanced, but it only goes to hundreds at the moment. When it hits thousands it may not be so WU efficient.

You use the “formatted as text” operator to accomplish this

1 Like

I just saw that Postmark is beta testing a bulk endpoint for the broadcast stream. You can take a look in the developer documentation.

I’m using postmark to send batch emails and @johnny is right you should use the format as text operator right the do a search, between [ ] in the body json, separator is a comma

Would it be possible to get a screenshot of what you mean please? I think I understand but just want to make sure before I mess anything up.

YES
documentation


1 Like

Make sure to run them only in backend workflows or else the postmark API token will be exposed to the user

Also FYI, Postmark just launched early access beta to their bulk endpoint for their broadcast streams

If you’re looking to send the same message to multiple recipients with a single API call—for example to send newsletters, marketing announcements, or similar—our Bulk endpoint makes that easy:

  • You define the message content (and attachments, if you’d like to send any) only once, and then use template variables to customize the message for each recipient, if needed.
  • You can add as many recipients as you need per API call, as long as you stay within the 50 MB payload size limit, including attachments.
  • Postmark will optimize the sending speed for you. If you’re sending a large amount of emails at once, we’ll release them at the appropriate rate for best deliverability results.

So it removes the 500 limit in the batched endpoint

2 Likes

Saw it ! but I rather prefer to not use beta features in production :melting_face:

Fair, hope they ship it on prod soon, I’m not using it in any prod app either, just testing :sweat_smile:

1 Like

Indeed - I’m right near the limit at the moment, one of my customer is sending about 450 emails at a time, hoping that I don’t have to implement some temporary solution while waiting for the bulk API.

Out of interest, is there much of a difference in terms of set up, compared to the batch send?

I’ve been using the Bulk endpoint for almost 2 months in Production - about 15,000 emails/ month and have no problems. I’ve noticed in the past that their Beta stage is usually dependable

1 Like