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
已回答 1 年前
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!

已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则