Skip to content

docs: add AI fallback use case combining Label the incoming message and Open a ticket#645

Open
SangeetaMishr wants to merge 5 commits into
mainfrom
docs/ai-fallback-label-and-open-ticket
Open

docs: add AI fallback use case combining Label the incoming message and Open a ticket#645
SangeetaMishr wants to merge 5 commits into
mainfrom
docs/ai-fallback-label-and-open-ticket

Conversation

@SangeetaMishr

@SangeetaMishr SangeetaMishr commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #550

Adds a "Use Case: Escalating unanswered AI queries to a human agent" section to the Open a ticket with a human agent doc, answering the Discord question referenced in the issue:

  1. How to add Label the incoming message in the AI fallback path so unhandled messages get labeled automatically (e.g. AI_unhandled).
  2. How to add Open a ticket with a human agent right after labeling, so those queries route to a human agent.

The walkthrough covers:

  • Capturing the contact's question, then calling the AI Assistant as usual
  • Configuring the assistant's Instructions to return one consistent fallback phrase when it can't answer
  • Using Split by a result in the flow on the assistant's response to branch on that fallback phrase (or the Other branch)
  • Labeling that branch with AI_unhandled right there - since no Wait for Response runs between the contact's original question and this point, the label still lands on the original question, not the AI's reply
  • Adding the Open a ticket with a human agent node immediately after, using the original question as the ticket body

Cross-links to the existing File Search / OpenAI Assistants doc, the Split by a Result in the Flow doc, and the Label the incoming message doc (recently expanded in #644) rather than duplicating their content.

Verification

No Glific feature returns a built-in "AI couldn't answer" signal, so the guidance relies on the org configuring a consistent fallback phrase in the assistant's Instructions and branching on it - this matches how orgs actually do this today per the linked Discord thread. The claim that the label still applies correctly a few nodes after Wait for Response (as long as no other Wait for Response intervenes) is grounded in glific/glific's add_input_labels behavior verified while writing #644 (it labels context.last_message, which is only overwritten when a new inbound message resumes the flow).

Test plan

  • Docs site renders the new section and links correctly
  • Reviewer confirms this matches the pattern recommended on Discord

Summary by CodeRabbit

  • Documentation
    • Updated the “Open a ticket with a human agent” guide with the latest revision date.
    • Added a new use case for escalating unanswered AI queries to a human agent, including a consistent fallback phrase, tagging the original incoming message, and opening/routing a ticket using the original question (plus handling the webhook call failure path).

…cket for AI fallback

Answers the Discord question in #550 on how to auto-label
AI-unhandled queries and escalate them to a human agent ticket.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@SangeetaMishr, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c84f0f33-a4bd-4220-9c2a-413379b84c1c

📥 Commits

Reviewing files that changed from the base of the PR and between 585ab80 and 0ef4e0d.

📒 Files selected for processing (1)
  • docs/4. Product Features/03. Flows/2. Flow Actions/16. Open a ticket with a human agent.md
📝 Walkthrough

Walkthrough

Updated the feature metadata date from October 2025 to July 2026. Added a use-case section documenting how unanswered AI queries are escalated through a webhook fallback phrase, original-message labeling, human-agent ticket creation using the original question, and separate handling of the webhook Failure exit.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the doc update about AI fallback handling and opening a ticket.
Description check ✅ Passed The description is directly about the added AI fallback workflow and related documentation links.
Linked Issues check ✅ Passed The PR addresses #550 by explaining how to label unanswered AI messages and open a human-agent ticket afterward.
Out of Scope Changes check ✅ Passed The changes stay within the requested documentation update and related metadata refresh.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 4, 2026 12:51 Inactive
@SangeetaMishr SangeetaMishr self-assigned this Jul 4, 2026
sangeeta1911 and others added 2 commits July 4, 2026 18:30
…tion

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Removing backticks around @results.<result name from step 1> left
raw angle brackets, which MDX parsed as an invalid JSX tag and
failed the build. Restore backticks around just this placeholder.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pull request July 5, 2026 15:57 Inactive

2. In your AI Assistant's Instructions, ask it to always reply with one clear, consistent phrase when it can't answer, for example "I'm not able to help with that yet." This gives the flow something reliable to check for.

3. Add a [Split by a result in the flow](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Actions/Split%20By/Result%20in%20the%20Flow/) node on the assistant's response (e.g. @results.gptresponse.message). Create a branch matching that fallback phrase, or use the Other branch to catch anything that isn't one of the assistant's expected answers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@results.gptresponse.message is not enclosed in a code block. Also, I feel it would be good to clarify, this variable contains the response generated by the AI assistant where gptresponse refers to the result name of the Call a Webhook node through which the assistant is being called.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add that this should be configured after success / failure of the webhook call and before this response is sent to the user.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 585ab80: @results.gptresponse.message is now code-formatted, and I've added a note clarifying gptresponse is the result name of the Call a Webhook node used to call the assistant. I've also restructured the steps to make explicit that this check goes on the Success exit of the Call a Webhook node, before the assistant's reply is sent to the contact, and added a note on handling the Failure exit separately.

@tanuprasad530 tanuprasad530 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the comments added, it would be good to add screenshot(s), if not for every step, just one screenshot showing the configuration would suffice.

- Wrap @results.gptresponse.message in code formatting and clarify
  that gptresponse is the result name of the Call a Webhook node used
  to call the assistant
- Make explicit that the fallback check runs on the Success exit of
  the Call a Webhook node, before the assistant's reply is sent to
  the contact, and add guidance on handling the Failure exit

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@SangeetaMishr

Copy link
Copy Markdown
Contributor Author

Pushed 585ab80 addressing both inline comments (code-formatting @results.gptresponse.message + clarifying it's the Call a Webhook result name, and making explicit that the fallback check goes on the Success exit before the reply is sent, with a note on handling Failure separately).

On the screenshot request: I don't have access to a live Glific instance in this environment to capture a new one for this combined use case. Each node this walkthrough references already has its own configuration screenshot on its own doc page (Split by a Result in the Flow, Label the incoming message, and the Open a ticket steps above in this same page), which I've linked to. If a screenshot of this specific combined setup is still wanted, I'd need someone with app access to grab one and I'm happy to slot it in - let me know if that's still a blocker for merging.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/4`. Product Features/03. Flows/2. Flow Actions/16.  Open a ticket with a
human agent.md:
- Line 188: Update the guidance around the Split by a result node on
`@results.gptresponse.message` to require an exact branch matching the configured
fallback phrase for escalation. Clarify that the Other branch must not be
presented as equivalent, and should be used only when every non-matching
response is intentionally treated as unhandled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1860686c-b980-4401-9eeb-8f150e1a02c4

📥 Commits

Reviewing files that changed from the base of the PR and between 8d95830 and 585ab80.

📒 Files selected for processing (1)
  • docs/4. Product Features/03. Flows/2. Flow Actions/16. Open a ticket with a human agent.md


3. In your AI Assistant's Instructions, ask it to always reply with one clear, consistent phrase when it can't answer, for example "I'm not able to help with that yet." This gives the flow something reliable to check for.

4. On the `Success` exit of the Call a Webhook node - before the assistant's reply is sent back to the contact - add a [Split by a result in the flow](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Actions/Split%20By/Result%20in%20the%20Flow/) node on `@results.gptresponse.message` (the assistant's response - `gptresponse` here is the result name you gave the Call a Webhook node in step 2, so adjust it if you used a different name). Create a branch matching that fallback phrase, or use the Other branch to catch anything that isn't one of the assistant's expected answers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not present the Other branch as an equivalent fallback.

If only the fallback phrase is configured, Other receives every response that does not exactly match it—including valid AI answers. Clarify that the exact fallback-value branch should be used for escalation; use Other only when all non-matching responses are intentionally considered unhandled.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/4`. Product Features/03. Flows/2. Flow Actions/16.  Open a ticket with a
human agent.md at line 188, Update the guidance around the Split by a result
node on `@results.gptresponse.message` to require an exact branch matching the
configured fallback phrase for escalation. Clarify that the Other branch must
not be presented as equivalent, and should be used only when every non-matching
response is intentionally treated as unhandled.

@SangeetaMishr

Copy link
Copy Markdown
Contributor Author

@tanuprasad530 worked on the comments suggested above please review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add detailed steps on Label the incoming message & Open a ticket with a human agent

3 participants