The following interpolation key is invalid: name

AI-generated summary

The following interpolation key is invalid: name

jordan-violet encountered an error when trying to address a user’s name in a system message. Lilly provided a link to a meta thread discussing available interpolation keys, but it didn’t help in this case.

supermathie and gerhard suggested that certain system messages can use additional interpolation keys, such as username, name, and name_or_username, but these are currently limited to specific welcome messages.

jordan-violet was able to resolve the issue thanks to the help of Lilly, supermathie, and gerhard, who provided guidance on how to use these interpolation keys.

A related question was raised by mjr4684 about extending this behavior to chat notifications, but Lilly was unsure if this was possible.

I’m trying to update system_messages.welcome_tl1_user.text_body_template and address the user’s name in the message, but getting the error: The following interpolation key is invalid: name:

Is there a library or doc that I’m missing where we can see which variables can be used in which messages?

i think this may be your answer:

Thanks Lilly, that’s a bummer. It would be nice to address the user’s name in some of them.

This is not my area but taking a look at ALLOWED_CUSTOM_INTERPOLATION_KEYS it appears you can use additional values for certain messages.

In particular:

    %w[system_messages.welcome_user] => %w[username name name_or_username],

I think if we changed this to:

    %w[system_messages.welcome_] => %w[username name name_or_username],

It would let you use those for other welcome messages. I’ll ask around.

In theory we should be able to add all system_messages.* keys as long as they have subject_template and text_body_template subkeys. Because all of them should be handled by the SystemMessage class which adds username, name, name_or_username as additional interpolation keys.

there we go :slight_smile:

This is indeed the way! Thank you so much for your efforts, Lilly—truly appreciated!

heh well i didn’t do anything other than copy and paste. those other good folks @gerhard, @supermathie and @SaraDev deserve the credit :clap: :sweat_smile:

They say it takes a village!

Could this behavior be extended to chat so notification emails can include the user’s name in the subject instead of their username?

you would have to edit the chat email text and change the key from username to their full name. but i have no idea if this is possible. the chat configuration is not my forte. i would go to settings-customize-email and search for a chat email template in the top drop down menu. all the editable email templates are in that drop down.