Skip to content

Core: Reply Engine #4

Description

@ggondim

Summary

Implement the Reply Engine — the component that processes the message field from recipient inbound requests, classifies each item (Chat SDK vs A2H), selects the appropriate reply method, and orchestrates rendering and response collection.

Tasks

Message Processing

  • Parse message field: normalize single object to 1-item array
  • For each item, classify via duck typing: presence of intent = A2H, otherwise = Chat SDK
  • Chat SDK path: delegate to ChannelAdapter.renderChatSDK()

A2H Method Selection (decision tree)

  • Implement the automatic selection logic:
    Trust layer active? → method 3 (external form)
    Simple AUTHORIZE → method 1 (inline) if buttons, else method 3
    COLLECT closed options → method 1 if selects/buttons, else method 3
    COLLECT free-text (1 field) → method 2 (capture hierarchy: thread → reply → DM → method 3)
    COLLECT multiple fields → method 3
    Multiple A2H intents → method 4 (batch form)
    INFORM → fire-and-forget
    ESCALATE → escalation handler
    
  • Method 1 — Inline: delegate to ChannelAdapter.renderA2HInline()
  • Method 2 — Text capture: delegate to ChannelAdapter.captureResponse() with capture hierarchy
  • Method 3 — External form: generate form URL, send link in channel, await submit
  • Method 4 — Batch: group multiple intents into single form page

Response Collection

  • Block on A2H intents (except INFORM) until response received
  • Return responses to recipient in array, same order as intents
  • Handle timeouts for blocking intents (configurable)

Acceptance Criteria

  • Single text message → rendered via Chat SDK adapter
  • Mixed array (text + AUTHORIZE) → text sent, then AUTHORIZE rendered with correct method
  • Method selection matches the decision tree for all intent/capability combinations
  • Blocking intents correctly wait for and return responses
  • Unit tests for classification, method selection, and array processing

Dependencies

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions