https://discord.gg/botpress logo
How to trigger a feedback workflow after bot respo...
# 🤝help
w
I need my bot to ask the user if it's being helpful after the bot has responded to four messages. If the user says yes, the bot should suggest subscribing to my newsletter. I have a Workflow in Main with an AutonomousNode that includes the instructions and knowledge base. That works perfectly. What I'm doing is using the "After Incoming" hook to increment the variable event.state.conversation.messageCount. If the variable equals 4, I set event.state.conversation.goToFeedbackWorkflow to TRUE. Then in the "After Turn End" hook, if event.state.conversation.goToFeedbackWorkflow is TRUE, I try to go to a Workflow called "feedback_workflow". But it doesn't work - I get this error: "An error occurred on hook after_turn_end "GoToFeedback": Error: event.setFlag is not a function" I think my strategy is too complicated. Before this, I was trying a different approach: adding an 'Always' transition in the AutonomousNode that would go to a Card, and in that Card, using AI Transitions with expressions like {{goToFeedbackWorkflow ? 'GO_FEEDBACK' : 'CONTINUE'}} or {{@conversation.goToFeedbackWorkflow}} to create the flow and go to a Card where I could ask the user for feedback. But the AI Transition doesn't work (or maybe it's the transition from the AutonomousNode that doesn't work). That's why I tried using a separate workflow instead. What's the correct way to conditionally redirect to a different workflow after the 4th message? Is there a simpler pattern in Botpress for "after N messages, execute a specific workflow or node"?
w
i think you can just straight up tell that to the autonomous node
after answering four questions, take the "Feedback Workflow" transition (if it's a transition)
w
I actually tried implementing this by adding instructions to the AutonomousNode, telling it to ask for feedback after 4 messages. However, the bot ignored those instructions and never left the AutonomousNode. I asked it to go to a Standard Node in same workflow (Main). Perhaps I didn't write the instructions properly?
w
what LLM are you using?
w
you could try overriding your default model to something a bit smarter
like claude 4.5 haiku
and it'll follow that specific instruction much better
could you please try that out?
if your ask for feedback workflow is separate, tell the node to take its transition. or you could just ask for feedback in that same prompt
w
- If you use a transition, the expression must return true or false. - To use a workflow, you need to add a transition card to the workflow and specify in the card's instructions when and how the Autonomous Node should use it
w
Hi @wide-umbrella-5226 , I tried your suggestion, and changed to 4.5 haiku, and added this instructions: "IMPORTANT - FEEDBACK SYSTEM: - Keep an internal count of how many questions you have answered in this conversation - After answering the FOURTH user question, ask them: "Is the information I'm providing being helpful to you? 😊" - If the user responds positively (yes, sure, very much, etc.): Invite them to subscribe to the newsletter with this message: "I'm so glad it's being helpful! 🎉 If you'd like to keep receiving valuable content like this, I invite you to subscribe to our newsletter. Would you like to do that?" - If they respond negatively or neutrally: "Thank you for your feedback. I'll keep improving to help you better. What else can I help you with?" Continue answering questions normally after the feedback." This is a translation from Spanish, my original language. I tried to get feedback in AutonomousNode, to try it before going to a StandardNode or a Workflow. It doesn't work. @white-nest-40686 how can you create the condition for transition from AN to Workflow? I've created a StandardNode with feedback_workflow in Main workflow, and tried to connect to AN, but it did not work. Thanks!
w
Move the card from the standard node to the Autonomous Node (AN). When you include cards like workflows, transitions, actions, etc., in the AN, they serve as tools that the AN can use.
w
I can't move it to AN, editor tells "Standard cards cannot be dropped Into Autonomous nodes.". Another thing I tried before, was to add feedback_workflow inside AN, but I can't "reach" it. Maybe the key is in the instructions. https://cdn.discordapp.com/attachments/1440039799988813954/1440324643713192077/Captura_de_pantalla_2025-11-18_a_las_13.54.14.png?ex=691dbe5a&is=691c6cda&hm=a056eddbc77e74892ce5ce4e60d0a915d498e71b2f618b8b2e65a6dbbe9653cd&
w
hi ruben! how exactly is it not working?
like, what part is not working?
does it not ask for feedback on the fourth question?
w
Hi shen, yes, it ignores my instructions and keeps waiting for user inputs.
w
i'm a little confused. do you want it to ask for feedbacks, or take the "feedback_workflow" workflow?
w
Hi shen, I need this behavior: After the bot sends its 4th reply, it should immediately ask: “Am I being helpful?” - If the user says yes, show a newsletter signup link and then continue normal Q&A. - If no/other, just acknowledge and continue. I’m flexible on implementation (workflow, standard node, or Autonomous Agent), it just needs to trigger right after the reply and then return to normal handling.
w
Simply tell to the AN to show the link
w
can you show a screenshot of the agent in action, and you asking the four questions? your implementation seems correct enough
w
Yes, the last message in screenshot is number 5. You can see messageCount value, and goToFeedBackWorkflow is true. I know that I'm not using this, but I keep the hook, just to count messages. https://cdn.discordapp.com/attachments/1440039799988813954/1440347407471874101/Captura_de_pantalla_2025-11-18_a_las_15.21.55.png?ex=691dd38e&is=691c820e&hm=0d6d3915fa72fe5c06e3ceb7f2812c86e96c5b23c3f57e472efeb98927af5390&
Hi Zannax I tried some more simple instructions (just getting feedback) before telling it to show the link, but it did'nt work. AN ignores my instructions.
w
I see code execution, with the query (iteration 1), then the call to haiku (iteration 2), and the response message, which ends with return { action: 'listen' } https://cdn.discordapp.com/attachments/1440039799988813954/1440367241093976074/Captura_de_pantalla_2025-11-18_a_las_16.44.04.png?ex=691de607&is=691c9487&hm=83152b0c0eafa44274cceeaad719e2eb89f3e5c0cec877338120b99757d26765&