NovuN
Novu15mo ago
Dima_hat

Having subscribers without last name

I have one small question on how to handle actors without lastName (we have some such users)
We are using
{{actor.lastName}}
directly in some of our i18n strings and it works perfectly to any actors who contain lastName. If it is not provided - the template code appears directly in the notifications.
Trying to call
await novu.subscribers.identify(subscriber.id, {lastName: ''})

and checking subscriber data afterwards - doesn't show
lastName
in the object. Only after setting it to a single space we were able to remove the template appearing in the notifications, but storing a space there may be not the best thing as it can appear unexpectedly somewhere. Is there a better way to provide such empty variable or just not to show the template variable?
Was this page helpful?