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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠