How can I determine (in webhooks) the language the user has used during the email sign-in/-up flow?
Unanswered
South Polar Skua posted this in #help-forum
South Polar SkuaOP
Hi π
We are sending our own emails using the
While testing we are running in a problem that we seem to have no way to detect in which language we should send the sign-in/sign-up email.
- We have configured the clerkLocalization prop on the Next.js
- We can detect it using publicMetadata after the initial sign-up (but by that time it's too late)
Do you have an idea how to solve that issue?
We are sending our own emails using the
email.created webhook. While testing we are running in a problem that we seem to have no way to detect in which language we should send the sign-in/sign-up email.
- We have configured the clerkLocalization prop on the Next.js
ClerkProvider component.- We can detect it using publicMetadata after the initial sign-up (but by that time it's too late)
Do you have an idea how to solve that issue?
1 Reply
@South Polar Skua Hi π
We are sending our own emails using the `email.created` webhook.
While testing we are running in a problem that we seem to have no way to detect in which language we should send the sign-in/sign-up email.
- We have configured the clerkLocalization prop on the Next.js `ClerkProvider` component.
- We can detect it using publicMetadata after the initial sign-up (but by that time it's too late)
Do you have an idea how to solve that issue?
The issue is that the email webhook fires before the locale makes it into publicMetadata so by the time you need it, it is not there yet. What you can do is set it earlier in the flow. On sign-up, pass the locale through unsafeMetadata when you call signUp.create() and it will be on the user object when the webhook fires. On sign-in the user already exists so you can just pull their locale from publicMetadata in the webhook payload.