https://discord.gg/botpress logo
Knowledge base integration with txt files
# 🤝help
s
Hi, I have a front-end page in HTML that sends information to my chatbot. I can see that the bot receives the files, but my knowledge base doesn’t show the information from the files in my bot. How can I solve this problem? I’m using the free studio.botpress.cloud service. I would really appreciate your help. https://cdn.discordapp.com/attachments/1403360331153276929/1403360331786358835/Captura_de_ecra_2025-08-08_134436.png?ex=689744a8&is=6895f328&hm=a3a03efd850e2837d92d5837c229a0844b49e70d604ff17c80b6ad2225811c9f& https://cdn.discordapp.com/attachments/1403360331153276929/1403360332101062666/Captura_de_ecra_2025-08-08_134403.png?ex=689744a8&is=6895f328&hm=ba6266347c7d80b5a7660caa9c5cc9b06c18cd1b74fc578d762ff1d2872758e1&
p
What are you currently doing to pass theinformation received to your knowledge base, as that is not an automatic process. Knowledge base documents/info is in most cases meant to be added prior o the bot being used. Can you elaborate on your use case?
s
I want to create a simple web page ( i used netlify) that sends information to my chatbot in a .txt file, so it can be added to my knowledge base. I can send files, as you can see, but the information in the files doesn’t appear in the chatbot.
p
The information in the files doesn't appear as this is not a default process. To achieve this, you would need to add an action or execute code card containing code similar to the one below.
Copy code
js
const fileUrl = workflow.url[0] // Get the cleaned file URL
const knowledgeBaseId1 = '<your-kb-id>' // Assuming the KB1 knowledge base ID
const name = workflow.companyName

//Add the file to the knowledge base
const file = await client.uploadFile({
  key: `${knowledgeBaseId1}/${name}.pdf`, // Each file needs a unique key under your bot
  url: fileUrl, // This is the external URL where the file is currently located
  contentType: 'application/pdf',
  index: true,
  tags: {
      // Tags are optional but are useful for filtering files by a custom criteria you choose when using the "List Files" or "Search Files" API endpoints. You can change or remove the tags below based on your needs.
    knowledgeBaseName: 'brand-pdfs',
    source: 'knowledge-base',
    kbId: knowledgeBaseId1,
    title: workflow.companyName
  },
})
Hope this helps!