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 chosen "Redirect" as the message type and input the "treeID" & "compositeID" you want user to be redirected to on all the corresponding FAQ entries.
Expected Outcome
- 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).
- 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.
Sample Tree Structure
Edit the Tree Node for FAQ Module
Head to the Tree Node for FAQ Module.
Toggle on "Redirect" and select "Advanced".
Create an Advanced Redirect with the following sample 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".
Create an Advanced Redirect with the following sample code:
return new Promise(async (resolve, reject) => {
let result = this.member.botMeta.tempData.faq
if (result.treeID && result.compositeID) {
resolve({
tree: result.treeID,
nodeCompositeId: result.compositeID,
})
} else {
resolve()
}
})
- Save the node and see if you can get the expected outcome.