Else-if conditional statements in Sendgrid

148 views Asked by At

I want to use conditional statements as Dynamic Content in a Sendgrid email template. My JSON has "days_left" = integer and depending on the number being greater or equal to some value I want to return a sentence. I read the docs and came up with this that doesn't work though. Also, I haven't found in the docs a straightforward way to have "elseif" conditions. What I want to achieve ultimately is: If days_left >= 2, then plural sentence, if days_left = 1 then singular sentence, if days_left = 0 then custom sentence. The current code below only serves plural and singular sentence and doesn't even work.

{{#greaterThan days_left '2'}}
    <p>There're only {{ days_left }} days left to verify your account.</p>
{{else}}
    <p>There's only {{ days_left }} day left to verify your account</p>
{{/greaterThan}}
0

There are 0 answers