Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(crisp): add crisp chatbox for connected agents #2561

Merged
merged 8 commits into from
Jan 22, 2025

Conversation

Holist
Copy link
Collaborator

@Holist Holist commented Jan 10, 2025

close #2542

On initialise Crisp pour permettre aux agents de chatter directement avec le support.

Techniquement

https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/dollar-crisp/
https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/session-continuity/

J'ajoute un contrôleur stimulus qui va initialiser le Crisp avec les données de l'agent (prénom+nom, email et token de la conversation). On créé un token unique pour l'agent (en se basant sur son email) qui permettra de récupérer la conversation correspondante quand l'agent se reconnectera.
Dans le cas ou un autre agent se connecte sur la même machine il initialisera Crisp avec ses informations d'agent et passera sur sa propre conversation.
Crisp est désactivé en mode impersonate ou si l'agent n'est pas connecté ou si la variable d'environnement dédiée ENABLE_CRISP est false.
Pour gérer ces conditions j'ai ajouté un fichier FeaturesConcern et la variable @should_display_crisp_chatbox quiva set la propriété displayCrisp du contrôleur stimulus.
Dans le cas ou crisp ne doit pas être affiché le contrôleur logout de crisp l'agent encore connecté si il y en a un.

@Holist Holist self-assigned this Jan 10, 2025
@Holist Holist marked this pull request as draft January 10, 2025 12:59
@Holist Holist marked this pull request as ready for review January 15, 2025 14:08
@Holist Holist force-pushed the add_crisp_chatbox_for_agents branch from 58b7376 to 9734bef Compare January 15, 2025 15:20
Copy link
Collaborator

@aminedhobb aminedhobb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est top @Holist merci beaucoup 🙌 !
Je pense qu'on peut améliorer la façon de générer le token mais sinon ça a l'air tout bon 👍 💯 !

app/models/agent.rb Outdated Show resolved Hide resolved
app/controllers/concerns/features_concern.rb Outdated Show resolved Hide resolved
app/javascript/controllers/crisp_controller.js Outdated Show resolved Hide resolved
@Holist Holist requested a review from aminedhobb January 22, 2025 14:59
aminedhobb
aminedhobb previously approved these changes Jan 22, 2025
Copy link
Collaborator

@aminedhobb aminedhobb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 🙌 !!

@Holist Holist merged commit ffef538 into staging Jan 22, 2025
6 checks passed
@Holist Holist deleted the add_crisp_chatbox_for_agents branch January 22, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Support] Installation chatbox Crisp
2 participants