Skip to content

feat(plugin-flow-builder): send contact reasons conditional event when resolve node #BLT-2700 - #3293

Merged
Iru89 merged 8 commits into
masterfrom
BLT-2700-plugin-flow-builder-send-contact-reasons-conditional-event-when-resolve-node
Oct 5, 2026
Merged

Iru89 merged 8 commits into
masterfrom
BLT-2700-plugin-flow-builder-send-contact-reasons-conditional-event-when-resolve-node

Conversation

@Iru89

@Iru89 Iru89 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds Hubtype analytics support for the Contact Reasons Conditional flow node and emits a conditional_contact_reasons bot event when the node is resolved. The event records the case contact reasons from the session and which branch was taken (a configured contact reason name or default).

Context

Contact Reasons Conditional nodes route the conversation based on the contact reasons assigned to the Hubtype case. Product and analytics need visibility into which branch was selected and which contact reasons were present at resolution time, consistent with other conditional flow nodes (for example, custom, channel, or country conditionals).

Related ticket: BLT-2700.

Approach taken / Explain the design

  1. @botonic/core: Introduces EventAction.ConditionalContactReasons and EventConditionalContactReasons with contactReasons and result payload fields.
  2. botonic-plugin-hubtype-analytics: Adds HtEventConditionalContactReasons and wires it in createHtEvent so events are serialized with the correct snake_case properties.
  3. botonic-plugin-flow-builder:
    • Extracts branch matching into contact-reasons-conditional-matcher.ts (match by project_id and name against session._hubtype_case_contact_reasons).
    • Refactors FlowContactReasonsConditional to resolve the follow-up target in setFollowUp, store conditionalResult, and call trackFlow from processContent when the node is processed (same pattern as other conditional content fields).

The analytics result is the matched branch name, or the string default when no branch matches.

To document / Usage example

No public API changes for bot developers. When a bot flow includes a Contact Reasons Conditional node and Hubtype Analytics is enabled, resolving the node automatically tracks:

// Event shape (via createHtEvent / trackEvent)
{
  action: EventAction.ConditionalContactReasons,
  contactReasons: ['billing', 'support'], // names from the case
  result: 'billing', // or 'default'
  // ... standard flow_* fields
}

Testing

The pull request...

  • has unit tests

  • has integration tests

  • doesn't need tests because... [provide a description]

  • botonic-plugin-hubtype-analytics/tests/event-conditional-contact-reasons.test.ts: event creation and payload mapping.

  • botonic-plugin-flow-builder/tests/contact-reasons-conditional-matcher.test.ts: contact reason branch matching logic.

@Iru89 Iru89 self-assigned this Oct 2, 2026
@Iru89 Iru89 changed the title Blt 2700 plugin flow builder send contact reasons conditional event when resolve node feat(plugin-flow-builder): send contact reasons conditional event when resolve node #BLT-2700 Oct 2, 2026
@Iru89
Iru89 marked this pull request as ready for review October 2, 2026 11:52
@chatgpt-codex-connector

Copy link
Copy Markdown

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.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Test Results

46 tests  ±0   46 ✅ ±0   1m 14s ⏱️ -1s
 6 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 44c243f. ± Comparison against base commit 2cd5130.

Iru89 added 2 commits October 5, 2026 11:52
…ons label in ConditionalContactReasons component
…contact reasons in SystemDebugTrace component
@Iru89
Iru89 merged commit 7f6c29d into master Oct 5, 2026
6 checks passed
@Iru89
Iru89 deleted the BLT-2700-plugin-flow-builder-send-contact-reasons-conditional-event-when-resolve-node branch October 5, 2026 10:05
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