Pass dynamic server token to Postmark API

Postmark API requires a “server” token to be passed in the header of each call:

API is set up as:

image

Due to the way my app is set up, each customer has their own server inside postmark (it’s a B2B app that sends marketing emails).

API call requires me to enter a token to initialize and run - if I leave it blank, it fails, even when passing it through a dynamic value in the workflow.

image

image

How to I get this to work, so that it correctly routes the customers message to the right server?

Is your issue related to initializing call in API connector or running your action?

Running it - the API and all the workflow actions are running fine, but I can’t get it to use the right server.

Example:

I enter a server token in the API call to intialise it.
I pass the customers server token (variable) to the API, via the workflow
Postmark still sends it through the server whose token is in the API settings.
If I leave it blank, the API call fails entirely.

Check your privacy rules. You should delete the API connector value or this will be used by default if blank (if you didn’t activate the blank checkbox). Your issue is probably more related to how you pass the value to the action. Try to check ignore privacy rules to validate if this is related to privacy. Be sure the user your are testing with have the token available. (Create a test page with a text that show the expression you have for header (Campaign’s parent customer’s portmask server token)

You’re comment pointed me in the right direction, but as usual,. turned out to be incredibly simple.

You can pass a variable server token by deleting the one in the API call, as you said, however what I didn’t edit was the “messagestream” portion of the API JSON.

The server token is the same regardless of which customer I’m referencing, but it’s the message stream that I need to store and pass through the API.

Thanks for the help!

1 Like