Skip to main content

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

  1. 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
Example of FAQ Chatbot Data source with Redirect
  1. 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
Example of FAQ Chatbot with Redirect

Sample Tree Structure

Tree Structure of FAQ Chatbot with Keyword Groups Match & Diversion
Tree Structure of FAQ Chatbot with Keyword Groups Match & Diversion

Edit the Tree Node for FAQ Module

  1. Head to the Tree Node for FAQ Module.

  2. Toggle on "Redirect" and select "Advanced".

  3. 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()
}
})
  1. Save the node.

Edit the Tree Node for Diversion

  1. Head to the Tree Node for Diversion.

  2. Toggle on "Redirect" and select "Advanced".

  3. 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()
}
})
  1. Save the node and see if you can get the expected outcome.