I am using custom policy that calls SendGrid API to send mails for OTP. The API is successful in sending however the subject part does not reflect the value from the request.
This is my custom policy code that generates the JSON.
<ClaimsTransformation Id="GenerateEmailRequestBody-Local" TransformationMethod="GenerateJson">
<InputClaims>
<InputClaim ClaimTypeReferenceId="email" TransformationClaimType="personalizations.0.to.0.email" />
<InputClaim ClaimTypeReferenceId="otp" TransformationClaimType="personalizations.0.dynamic_template_data.otp" />
<InputClaim ClaimTypeReferenceId="email" TransformationClaimType="personalizations.0.dynamic_template_data.email" />
<InputClaim ClaimTypeReferenceId="subject" TransformationClaimType="subject" />
</InputClaims>
<InputParameters>
<!-- Update the template_id value with the ID of your SendGrid template. -->
<InputParameter Id="template_id" DataType="string" Value="d-xxxxxxxxxxxxxxxxxxxxxxxxxx" />
<!-- Todo: update the sender -->
<InputParameter Id="from.email" DataType="string" Value="sender@gmail.com" />
<InputParameter Id="from.name" DataType="string" Value="Administrator" />
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="emailRequestBody" TransformationClaimType="outputClaim" />
</OutputClaims>
</ClaimsTransformation>
Below is request generated from the custom policy and sent to SendGrid.
{
"personalizations": [
{
"to": [
{
"email": "someone@gmail.com"
}
],
"dynamic_template_data": {
"email": "someone@gmail.com",
"otp": "086924"
}
}
],
"subject": "Verification code",
"template_id": "d-xxxxxxxxxxxxxxxxxxxxxxxx",
"from": {
"email": "someone@gmail.com",
"name": "Administrator"
}
}
Is there a part that I've missed? Please help.