Extension Help: Feedback Thumbs
Does anyone know what action body and Javascript I need to implement in the feedback extension to get the right response when the user clicks thumbs up or down?
I tried following @NiKo | Voiceflow's video but I have not managed to make this extension work
5 Replies
To implement the feedback extension for thumbs up or down in Voiceflow, you need to follow a few steps.
Firstly, you need to define your extension in your web chat installation code. This extension will be of the 'response' type as it will render a custom widget inside the Voiceflow Web Chat. Here's an example of how you might define a 'Feedback' extension:
In the 'match' function, you're checking if the payload of the incoming trace matches the name of your extension. If it does, the 'render' function will be called to render your custom widget.
Next, you need to trigger this extension in your Voiceflow design using the custom action step. The action body would look something like this:
Responses from the custom action are saved in a variable called
lastevent
in Voiceflow. This can be accessed and parsed using the Javascript step. For example, if you want to access the name from the payload, you can use name = lastevent.payload.name
.
Finally, in your 'render' function, you need to implement the logic for handling the user's click on the thumbs up or down. This will depend on how you've implemented your custom widget, but it will likely involve adding event listeners to the thumbs up and down buttons and updating the state of your widget accordingly.
For more examples, you can refer to the Voiceflow extensions demo repository on GitHub.But how do I get a thumbs up if the user clicks thumbs up and vice versa for thumbs down
automatic-azure•17mo ago
There's a piece of code on this in the extensions example github repo from voiceflow:
https://github.com/voiceflow-gallagan/vf-extensions-demo/blob/main/extensions.js
fascinating-indigo•17mo ago
I think what you're trying to say is, how do we retrieve the information when users press the feedback button, is that correct?
Yes! I want to set it up in a way that when the users clicks the thumbs up, that I can return a specific response and vice versa for thumbs down