#template variables

1 messages · Page 1 of 1 (latest)

pliant belfry
#

If i send a payload with {"key": undefined } or {"key" : null } and then use {{ key }} in a notification template but do not set "is_required" or "default" value for key, is it expected that in the activity feed for that in-app notification i see that novu is forcing the payload to be { "key": "" }? i find this somewhat odd because i explicitly set key to null or undefined so i don't expect novu to change it to an empty string. is there an explanation of how this is supposed to work and why? (specifically i would like to use handlebars conditionals to do {{ #if key }} but since novu is overriding the value with an empty string my conditional does not work as expected.

gentle moss
#

You can use empty string check in if condition?

pliant belfry
#

but is that behavior expected?

#

i find it very odd that the payload gets changed by novu

#

if necessary we will do an empty string check but we aren't intending to send an empty spring, we are specifically trying to send null or undefined

#

is there a list of handlebars helpers that it is possible to use? if we can't use a simple if true check then we need to use some type of string equality helper? but ideally novu shouldn't unexpectedly change the payload variables

pliant belfry
#

thank you

#

do you know if the behavior i described is a bug or not? i can't find any documentation of why this would happen

gentle moss
#

I think this is bug 🐛