User.given_name is rendering in welcome email template's body as empty space

I have set up the following liquid syntax if/else statement in the body of my customized welcome email template so that we can fallback to the given_name field if the email is sent before our rule to populate the custom user_metadata field is run:

{% if user.user_metadata.firstName %}
    Hey {{ user.user_metadata.firstName }}, your new account awaits!
{% else %}
    Hey {{ user.given_name }}, your new account awaits!
{% endif %}

When I trigger the welcome email for a user with an empty user_metadata.firstname field, but with a populated user.given_name field (“Jenna”), the value that is rendered in the sent email is an empty empty string (“Hey , your new account awaits!”).

Can someone please help me figure out the problem here? user.given_name is listed in the support documentation on fields that are available when customizing emails, and I am seeing this behavior in testing both through signing up as a new user and by triggering the email template to myself via the template’s “Try” button.

Hey there!

I’m just checking our docs on this. Will get back to you shortly!

Sooo reading this doc:

it seems that both of the options should work BUT to be honest here conditional checking is not necessary (you’re only checking if given_name or user_metadata.first_name exists). Can you try configuring it the way so for every case it just use liquid syntax to welcome specific person and see if such syntax works so:

Hello {{ user.given_name }}, your new account awaits!

Hi Konrad!

Thanks for your quick reply! I tried changing to just Hello {{ user.given_name }}, your new account awaits!, and that does work correctly. But we only want to use user.given_name if user.user_metadata.firstName is not yet filled out. How do you suggest we get to that solution? Ultimately, we’d actually also like to default to a static text value (“there”) if neither of the other values is available.

Let me talk it over with the appropriate team and get back to you as soon as I have news to share!