2
0

🐛 (chatwoot) Fix email prefill when Chatwoot contact already exist

This commit is contained in:
Baptiste Arnaud
2023-11-20 15:22:11 +01:00
parent 1a44bf4935
commit 94886ca58e
2 changed files with 7 additions and 1 deletions

View File

@@ -44,3 +44,9 @@ You can link the current result URL to the Chatwoot conversation by creating thi
src="/img/blocks/integrations/chatwoot/custom-attribute.png"
alt="Chatwoot custom attribute"
/>
### Set user behavior
If you are prefilling user information, by default, if you leave the ID input empty, it will set the Chatwoot user ID as either the `Email` or the Result ID.
Setting the `Email` as the ID allows us to avoid having contact not properly merged together (https://github.com/chatwoot/chatwoot/issues/2811)

View File

@@ -13,7 +13,7 @@ const parseSetUserCode = (
) =>
user?.email || user?.id
? `
window.$chatwoot.setUser(${user?.id ?? `"${resultId}"`}, {
window.$chatwoot.setUser(${user?.id ?? user.email ?? `"${resultId}"`}, {
email: ${user?.email ? user.email : 'undefined'},
name: ${user?.name ? user.name : 'undefined'},
avatar_url: ${user?.avatarUrl ? user.avatarUrl : 'undefined'},