AWS Steps - how to pass a dynamic JSON String

0

Hi, I'm trying to create an AWS Steps Machine, I've got the majority of it working now, except I want to send an SES V2 email, this takes a JSON string variable called Template Data, where I want to send dynamic values, and I cannot work out how to do this from steps.

Two things I've tried are;

"TemplateData.$": "States.Format('{ "name":"{}", "prizeValue": "{}", "emailAddress": "{}"}', $.Query.Item.Name.S, $.PrizeValue , $.Query.Item.Email.S)"

But as it uses {} as a variable placeholder, it won't let me use them elsewhere, I've tried escaping it to no avail.

I've also tried using something akin to

"TemplateData.$": "States.JsonToString({'Name.$' : 'Query.Item.Name'})"

But I get "The value for the field 'TemplateData.$' must be a valid JSONPath or a valid intrinsic function call (at /States/Parallel/Branches[1]/States/SendEmail (1)/Parameters)"

2 個答案
1

Did you try something like:

"TemplateData": {
  "name.$": "$.Query.Item.Name.S", 
  "prizeValue.$": "$.PrizeValue",
  "emailAddress.$": "$.Query.Item.Email.S"
}
profile pictureAWS
專家
Uri
已回答 2 年前
0

Thank you very much - I think this is one of them moments where I was chasing my tail. I tried the above and it didn't work, I thought it was because the JSON passed in to TemplateData absolutely had to be stringified. However I've just tried it to paste the error message here and it's worked! I must have made a different mistake and presumed it wasn't the way to achieve it, when I should have gone back to it again. Thank you very much, my app is now ready for testing as that was the final piece!

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南