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

feedback knoweldege base with thumbsUp/thumbsDown #2859

Conversation

Iru89
Copy link
Contributor

@Iru89 Iru89 commented Jun 19, 2024

Description

Add feedback_knowledgebase event
Be able to add ThumbsUp and ThumbsDown buttons to give feedback on webchat messages.
When the flow builder creates a message using the knowledge base Uses the Text component with new withfeedback and inferenceid attributes

The withfeedback and inferenceid attributes cannot be declared using camelCase because when they pass through the backen they come back with everything in lowercase, it doesn't work with snake_case either. I'm not sure but I think it's because of the html parser, the attributes have to be single words or use kebab-case.

Context

Review this PR commit by commit:
plugin-hubtype-analytics: add feedback_knowledgebase event

botonic-react: Refactor the FooterMessage and add the FeedbackMessage which contains the ThumbsUp ThumbsDown buttons and uses the trackEvent function when clicked.

botonic-react: Add the possibility to inject the onTrackEvent function from the bot to the webchat to create events from the frontend. Just like we already have the onInit, onOpen, onClose, onMessage functions.

plugin-flow-builder: When the flow builder plugin uses the knowledge base to generate a message it creates a @botonic/react Text with the new withfeedback and inferenceid attributes needed for tracking.

The other commits are a refactor that renumbers the with_feedback attrbute to feebackEnabled using camelCase

Approach taken / Explain the design

Design
Captura de pantalla 2024-06-21 a las 14 02 23

To document / Usage example

How to pass the tracking function from bot to webchat
/webchat/index.ts

export const webchat: WebchatArgs = {
  onInit: app => {
    window.botonicOnInit(app)
  },
  ...
  onTrackEvent: async (request, eventName, args) => {
    const pluginHubtypeAnalytics = new BotonicPluginHubtypeAnalytics()
    const htEventProps = {
      action: eventName as EventAction,
      ...args,
    } as HtEventProps
    await pluginHubtypeAnalytics.trackEvent(request, htEventProps)
  },
  theme: {
  ...

Testing

Adds a test for the new feedback_knowledgebase event

Copy link

linear bot commented Jun 19, 2024

@Iru89 Iru89 changed the title WIP plugin-flow-builder: feedback message for message generated with knowledge base Jun 19, 2024
@Iru89 Iru89 force-pushed the feature/blt-630-i-want-to-be-able-to-provide-feedback-for-each-response branch 4 times, most recently from 1e42658 to 44fbd25 Compare June 21, 2024 11:40
@Iru89 Iru89 changed the title plugin-flow-builder: feedback message for message generated with knowledge base plugin-flow-builder: feedback knoweldege base with thumbsUp/thumbsDown Jun 21, 2024
@Iru89 Iru89 changed the title plugin-flow-builder: feedback knoweldege base with thumbsUp/thumbsDown feedback knoweldege base with thumbsUp/thumbsDown Jun 21, 2024
@Iru89 Iru89 marked this pull request as ready for review June 21, 2024 16:05
@Iru89 Iru89 force-pushed the feature/blt-630-i-want-to-be-able-to-provide-feedback-for-each-response branch from 44fbd25 to 8d90eb7 Compare July 1, 2024 13:04
@Iru89 Iru89 merged commit e97f213 into master-lts Jul 9, 2024
3 of 4 checks passed
@Iru89 Iru89 deleted the feature/blt-630-i-want-to-be-able-to-provide-feedback-for-each-response branch July 9, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants