API Connector POST with dynamic data (postmark email)

Hello!

I’m trying to send your some data from a repeating group to an email template in Postmark.

In the template there are some repeating fields that are set up this way:

"calculation_details": [
	{
		"description": "description_Value",
		"amount": "amount_Value"
	}
]

In the API connector body, I have entered following:

    "calculation_details": [
	{
		"description": "<description_Value>",
		"amount": "<amount_Value>"
	}
]

And then down in the parameters I can set the description_Value and amount_Value like in the screenshot.

When I do a manual call this works, the email gets sent with parameters to the template. But how Do I send these parameters from the workflow from the repeating group?

This will be a list of items chosen from a checklist where the user should get the list via e-mail.

Plese help!

2 Likes

Hey there @nemanja.rilakovic,

Have you unchecked “private?”

2 Likes

you need to uncheck “private” for each parameters. They will be available in the workflow

1 Like

Awesome!! Thanks guys, now it works! thanks for the quick response.

Now I arrived at the next issue. In the email template the chosen items appears on the same row like this:

This might be an issue in the template maybe. I’m using the basic template from postmark.

This is how the HTML template looks like.

It seems like all of them are getting into the same table row.

Actually, you are putting everyting in the same parameters.
But in this case, you need to have an object {} for each line
Example:
“calculation_details”:[
{“description”:<description_value>“,“amount”:”<amount_value>“},{“description”:<description_value>”,“amount”:“<amount_value>”}]
this mean 2 line.
But if you have dynamic data that will change on how many item you will have, you will need to use a more complex option
You will set in API Connector: “calculation_details”:[<calc_detailss],
And in the workflow, for this part, you will use :format as text.

Please read this post for a few informations about that

1 Like

Thanks @Jici, now it works perfect!!

1 Like

Do you mind sharing how did you achieved it?

Thanks!

Sure!

In the API-connector I substituted the whole JSON part that will loop with a handle like this (compare it with the picture in my first post and you will get the substitution):

So the “calculation_details” : [<calculation_details>]

And then in the workflow you find the repeating group or a list you want to parse in there and use :format_as_text

Then in the text field content you put in the whole expression that should loop, and just substitute the variables with “add dynamic content” lite this:

This way the JSON data gets in the correct way into the HTML template.

I hope this gave you some more info, sorry for the swedish variable names.

5 Likes

Yup! So glad they added the :format as text functionality

Thanks for the explanation :raised_hands:.

Why is there so much space between the “{” and the “description”? Also between the “,” and the “amount”?

There is no reason, it just turned out this way when I cut/pasted the code from the API connector. :joy: Just ignore that!

1 Like

@nemanja.rilakovic @ryanck
Hi there ! I’m struggling on this one ;( I read your post, but it seems i cannot make it works … if you have any idea, that would be nice ^^
The email i’m trying to send works well with postmark, but when i try to add a list as you have set up, i do not receive any email … Attached you can check my set up
any clue ? many thanks



Screen Shot 2022-08-26 at 11.22.33
Screen Shot 2022-08-26 at 11.23.08
Screen Shot 2022-08-26 at 11.22.45