-
Notifications
You must be signed in to change notification settings - Fork 10
docs: add AI fallback use case combining Label the incoming message and Open a ticket #645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
519731e
323dfb2
8d95830
585ab80
0ef4e0d
49e0cc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| <tr> | ||
| <td><b>5 minutes read</b></td> | ||
| <td style={{ paddingLeft: '40px' }}><b>Level: Advanced</b></td> | ||
| <td style={{ paddingLeft: '40px' }}><b>Last Updated: October 2025</b></td> | ||
| <td style={{ paddingLeft: '40px' }}><b>Last Updated: July 2026</b></td> | ||
| </tr> | ||
| </table> | ||
| </h3> | ||
|
|
@@ -175,6 +175,44 @@ Once a ticket is created, users can make edits by utilizing the `Add Remark` opt | |
| <img width="567" alt="image" src="https://github.com/glific/docs/assets/143380171/554f2688-426b-4019-9552-b351ebbe0f6c"/> | ||
|
|
||
|
|
||
| ## Use Case: Escalating unanswered AI queries to a human agent | ||
|
|
||
| If you're using an AI Assistant to answer contact questions (see [File Search Using OpenAI Assistants](https://glific.github.io/docs/docs/Integrations/Filesearch%20Using%20OpenAI%20Assistants/)), some questions will fall outside what it can answer. Label the incoming message and Open a ticket with a human agent can be combined to automatically flag and route these to your team. | ||
|
|
||
| 1. Capture the contact's question with a Wait for Response node. | ||
|
|
||
| 2. Call your AI Assistant with a Call a Webhook node, giving it a result name such as `gptresponse`. Like any Call a Webhook node, this has separate `Success` and `Failure` exits. | ||
|
|
||
| 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This wont work as is, as today we can apply There are two ways to do it:
I'd suggest you add alternative 1 (the simple one) to solve this. |
||
|
|
||
| 5. On that branch, add a [Label the incoming message](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Actions/Label%20the%20incoming%20message) node and enter a label such as AI_unhandled. No other Wait for Response node runs between the contact's original question and this point, so the label still lands on that original question rather than on the AI's reply. | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| 6. Right after the label node, add an Open a ticket with a human agent node, following the steps above. Use `@results.<result name from step 1>` as the Ticket Body so the ticket shows the contact's original question, and assign it to the relevant staff member or queue. | ||
|
|
||
| <img width="565" height="355" alt="image" src="https://github.com/user-attachments/assets/5be8f7ac-5fea-40c2-af2d-e2394a774c0f" /> | ||
|
|
||
|
|
||
| <img width="544" height="398" alt="image" src="https://github.com/user-attachments/assets/fdde70e2-dbff-4ee7-a094-7ef59cb1b576" /> | ||
|
|
||
| <br /> | ||
|
|
||
|
|
||
| <img width="463" height="463" alt="image" src="https://github.com/user-attachments/assets/966f9482-d9b0-4ace-a627-49c937ec69d0" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this screenshot, I can see the flow starts with this node making the reference slightly misleading. |
||
|
|
||
|
|
||
|
|
||
| 7. On the branches that don't match the fallback phrase, continue as normal and send the assistant's reply (`@results.gptresponse.message`) to the contact. | ||
|
|
||
| You'll also want to handle the `Failure` exit of the Call a Webhook node separately - for example, by sending an error message or routing straight to a ticket - since that covers the webhook call itself failing, which is a different case from the assistant successfully responding with "I don't know." | ||
|
|
||
| This way, every query the AI can't resolve is labeled AI_unhandled and immediately handed off as a ticket, so you can report on how often the assistant falls back and make sure nothing gets missed. | ||
|
|
||
| ## Best Practices | ||
|
|
||
| - Always assign tickets to the right staff to ensure faster resolution. | ||
|
|
||
There was a problem hiding this comment.
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
Otherbranch as an equivalent fallback.If only the fallback phrase is configured,
Otherreceives every response that does not exactly match it—including valid AI answers. Clarify that the exact fallback-value branch should be used for escalation; useOtheronly when all non-matching responses are intentionally considered unhandled.🤖 Prompt for AI Agents