Redirect to Existing Chatbot Tree
The Level Three FAQ chatbot is very effective in handling 1 to 1 question and answer reply. However, if you want to incorprate a step by step conversation flow, you will need to set up the redirect function for redirecting user to a specific chatbot flow.
Please make sure you have choosn "Redirect" as the message type and input the "treeID" & "compositeID" you want user to be redirected to on all the corresponding FAQ entries. For details on FAQ data source format, please see here.
What is your Result?
- When user types the question (e.g. How much time do you need to build a WhatsApp chatbot?), the FAQ module will scan the entire data source to see if there is an exact match in the keyword group(s).
Example of FAQ Chatbot Data source with Redirect
- Once matched with an FAQ entry, instead of displaying the answer of the corresponding entry from the data source, the user will be redirected to a tree node with the text response.
Example of FAQ Chatbot with Redirect
Getting Hands-on
Sample Tree Structure
Tree Structure of FAQ Chatbot with Keyword Groups Match & Diversion
Edit the Tree Node for FAQ Module
Head to the Tree Node for FAQ Module.
Toggle on "Redirect" and select "Advanced".
Paste the following code:
return new Promise((resolve) => {
let ans = this.member.botMeta.tempData.faqAns || []
if (ans.length === 1) {
if (ans[0].treeID && ans[0].compositeID) {
resolve({
tree: ans[0].treeID,
nodeCompositeId: ans[0].compositeID,
})
} else {
resolve()
}
} else {
resolve()
}
})
- Save the node.
Edit the Tree Node for Diversion
Head to the Tree Node for Diversion.
Toggle on "Redirect" and select "Advanced".
Paste the following code:
return new Promise((resolve, reject) => {
let result = this.member.botMeta.tempData.faq
if (result.treeID && result.compositeID) {
resolve({
tree: result.treeID,
nodeCompositeId: result.compositeID,
})
} else {
resolve()
}
})
- Save and see if you can produce the expected outcome.