Getting an application name into the welcome email

I have custom templates for email verification and welcome. The welcome template uses {{application.name}}. I have an org with a single connection to an application. I invite someone to join the org and they follow the link in the verification email. The welcome email they receive substitutes the raw tenant name for {{application.name}}. Looking in the logs, I see a “Success Verification Email” entry with the application set to “All Applications” and a corresponding client_id that does not match that of the one application this org has access to. How can I have the welcome email use the client_id for this one application? (I am assuming that the wrong client_id is the cause of seeing the raw tenant name.)