References when building chatbot with documents

Is there a way to have the chatbot reference the page number of the document its getting the answer from similarly is there a way to have the chatbot reference the url link of the page when getting answers from a website?

Hi @farhadmudassar ,

Yes, you can find it in the JSON tab as below. You can access it using code and extract the info from there - {{event.suggestions.[0].sourceDetails}}:
image

Can you provide the code that can extract the urls from {{event.suggestions.[0].sourceDetails}}` please? Thank you.

Can you see if this do the trick?


var expression = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi
var regex1 = new RegExp(expression)
var t = event.suggestions[0].sourceDetails

if (t.match(regex1)) {
  console.log('Successful match')
  console.log(t.match(regex1))
} else {
  console.log('No match')
}