i need bot to display dynamic data from knowledgeb...
# 🤝help
e
i need bot to display dynamic data from knowledgebase
a
Hey @eager-cartoon-14662 have you tried using a web search knowledge source? It scrapes data from search engine results, so if your webpage gets updated the information should be current (as long as Google & Bing index your site regularly)
f
If i use Web pages instead of web search for my kb would it still get the updated information or do i have to update it some how every time new info get out there
a
If you use the web pages KB source you'll have to manually re-add the pages every time you want to update the information.
f
Ayyy. You should really make it so in the web search we can do more than just nike.com. Make it so we could do nike.com/shoes for an example.
a
well in theory that's what the Web Page source is for, while the broader web search does the whole website. With pages, you can list specific pages- but you're correct that they don't auto-update
f
Thats the thing. If i work with multiple companies its going to be hard for me to keep track of when to update the websites
a
Good point. If there's not something in #1111026806254993459 on dynamic knowledge base sources there ought to be. I know its on our roadmap but likely in Q4 2023
e
i need to display data from my webpage like you did in RECIPE FINDER in carousel style. every time a user searches for a product from web, the picture should display with the price instead of a text
can you write a code or smth
a
I won't write the code for you, but here is how the recipe bot takes its data from the Spoonacular API and turns it into a carousel. It is a good starting point to digesting your own API call's data.
Copy code
js
workflow.recipes = []
const myCards = workflow.recipeInfo.map((recipe) => {
  workflow.recipes.push({
    title: recipe.title,
    vegetarian: recipe.vegetarian,
    vegan: recipe.vegan,
    glutenFree: recipe.glutenFree,
    dairyFree: recipe.dairyFree,
    veryHealthy: recipe.veryHealthy,
    cheap: recipe.cheap,
    veryPopular: recipe.veryPopular,
    readyInMinutes: recipe.readyInMinutes,
    servings: recipe.servings,
    summary: recipe.summary
  })
  // create the card object
  return {
    type: 'card',
    title: {
      dynamicValue: `${recipe.title}`,
      valueType: 'dynamic'
    },
    subtitle: {
      dynamicValue: '',
      valueType: 'dynamic'
    },
    imageUrl: {
      dynamicValue: `${recipe.image}`,
      valueType: 'dynamic'
    },
    actions: [
      {
        action: 'url',
        label: 'View Recipe',
        value: `${recipe.sourceUrl}`
      }
    ]
  }
})
workflow.cards = []
for (var card of myCards) {
  workflow.cards.push({
    //in order to render a card, we only need these three fields
    title: card.title,
    imageUrl: card.imageUrl,
    actions: card.actions[0]
  })
}
☝️ @gentle-ability-75784
g
Perfect thank yoi!
e
thanks .
149 Views