Ajoute un nickname par défault pour les retours utilisateur sans email (#2396)

fix: Ajoute un nickname par défaut
pull/2398/head
Benjamin Arias 2022-11-23 17:24:47 +01:00 committed by GitHub
parent d84109f41e
commit 05910ba464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 6 deletions

View File

@ -29,9 +29,9 @@ type SendMessageParamsType = {
}
type ConversationMetaType = {
email: string
email?: string
subject: string
nickname: string
nickname?: string
}
type CrispType = {
@ -68,11 +68,21 @@ export const sendCrispMessage = async (body: BodyType) => {
const { session_id: sessionId } = result
await CrispClient.website.updateConversationMetas(WEBSITE_ID, sessionId, {
email,
nickname: email,
const metas: ConversationMetaType = {
subject,
})
nickname: 'Utilisateur inconnu (email non renseigné)', // Default value if no email
}
if (email) {
metas.email = email
metas.nickname = email
}
await CrispClient.website.updateConversationMetas(
WEBSITE_ID,
sessionId,
metas
)
CrispClient.website.sendMessageInConversation(
WEBSITE_ID,