Skip to content

plugin-flow-builder: resolve a button conected to go to flow to redirect to ai agents #BLT-2212 #3183

Merged
Iru89 merged 12 commits intomasterfrom
BLT-2212-plugin-flow-builder-resolve-a-button-conected-to-go-to-flow-to-redirect-to-ai-agents
Mar 17, 2026
Merged

plugin-flow-builder: resolve a button conected to go to flow to redirect to ai agents #BLT-2212 #3183
Iru89 merged 12 commits intomasterfrom
BLT-2212-plugin-flow-builder-resolve-a-button-conected-to-go-to-flow-to-redirect-to-ai-agents

Conversation

@Iru89
Copy link
Contributor

@Iru89 Iru89 commented Mar 16, 2026

Description

When a user taps a button in the Flow Builder that is connected to a Go to flow action targeting the AI Agents flow, the request is now correctly redirected to the AI Agents flow instead of being handled as a normal flow payload. The plugin detects this case before routing, tracks the flow event, clears the payload, and lets the AI Agents plugin handle the request.

Context

  • Problem: Buttons in the Flow Builder linked to a "Go to flow" that points to the AI Agents flow were not redirecting to the AI agent; the payload was still processed as a flow-builder payload, so the AI agent never took over.
  • Goal: Allow Flow Builder flows to hand off the conversation to the AI Agents flow when a Go-to-flow node targets the AI Agents flow, so that one bot can combine flow-based and AI-agent-based conversations seamlessly.

Approach taken / Explain the design

  • Detection: In FlowBuilderApi, added isGotToFlow(id) to determine if a given node ID is a Go-to-flow node. In updateRequestBeforeRoutes (now async), when the incoming payload is a Go-to-flow node, we resolve it.
  • Redirect to AI Agents: In FlowGoToFlow, added a static method resolveToAiAgentsFlow(botContext, component, cmsApi). It builds the Go-to-flow content from the CMS node; if the target flow name equals the AI Agents flow constant (AI_AGENTS_FLOW_NAME), it tracks the flow event (for analytics) and sets botContext.input.payload = undefined. Clearing the payload ensures no flow-builder route matches, so the request falls through to the AI Agents plugin.
  • Integration: The flow-builder plugin runs this resolution in updateRequestBeforeRoutes before routes are evaluated, so the redirect happens once per request and only when the payload is a Go-to-flow pointing to the AI Agents flow.

No changes to the AI Agents plugin were required; it already handles requests without a matching payload.

To document / Usage example

In Hubtype CMS (Flow Builder):

  1. Create a flow with a button or quick reply.
  2. Connect that button to a Go to flow node.
  3. Configure the Go to flow node to target the AI Agents flow (the flow whose name matches the configured AI Agents flow name, e.g. "AI Agents").
  4. When the user taps the button, the conversation is handed off to the AI agent; the flow event is tracked and the payload is cleared so the AI Agents plugin processes the message.

No code changes are required in the bot; enabling both @botonic/plugin-flow-builder and @botonic/plugin-ai-agents with the same AI Agents flow name is enough.

@Iru89 Iru89 self-assigned this Mar 16, 2026
@github-actions
Copy link

github-actions bot commented Mar 16, 2026

Test Results

42 tests   42 ✅  1m 33s ⏱️
 5 suites   0 💤
 1 files     0 ❌

Results for commit ac79ad1.

♻️ This comment has been updated with latest results.

@Iru89 Iru89 changed the title Blt 2212 plugin flow builder resolve a button conected to go to flow to redirect to ai agents plugin-flow-builder: resolve a button conected to go to flow to redirect to ai agents #BLT-2212 Mar 16, 2026
@Iru89 Iru89 marked this pull request as ready for review March 16, 2026 15:15
@Iru89 Iru89 requested a review from vanbasten17 March 16, 2026 15:15
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@Iru89 Iru89 requested a review from asastre March 16, 2026 15:16
@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 17, 2026
@Iru89 Iru89 merged commit 44b61e1 into master Mar 17, 2026
6 checks passed
@Iru89 Iru89 deleted the BLT-2212-plugin-flow-builder-resolve-a-button-conected-to-go-to-flow-to-redirect-to-ai-agents branch March 17, 2026 10:56
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