{last utterance} captures button name
I have a question. When the user presses a button, the button information is stored in {last_utterance}.
I don't want this. How can I prevent this from happening?
Context: The user types, for example, "I want a product that gives me more energy." Then, two buttons appear.
After that, an AI block will generate an answer based on {last_utterance}. But {last_utterance} no longer contains "I want a product that gives me more energy," but the name of the button.
I also can't set {last_utterance} to another variable with a set block because the AI block has multiple functions and needs the {last_utterance}.
2 Replies
{last_utterance}
is a system-controlled variable – it is overwritten every time the user does anything (types text, taps a quick-reply button, selects a carousel button, etc.).
Because of that behaviour it isn’t possible to “freeze” or exclude button clicks from {last_utterance}
. Instead use one of these work-arounds:
1. Store the message you care about in your own variable before you show the buttons
2. Rely on the conversation memory
• {vf_memory}
contains the last turns of the chat, so the user’s sentence and the fact they pressed a button are still there. Point your AI block at {vf_memory}
(or just use an Agent step, which already sends the memory automatically).
3. Detect button clicks separately
• {last_event}
is populated only when the user presses a button. You can branch on {last_event.type === "button"}
to handle the button logic, while keeping the user’s text stored in another variable for later prompts.
So while you can’t stop {last_utterance}
from changing, you can keep a copy of the earlier message (or use {vf_memory}
) and reference that in any downstream AI steps.Thanks