silly-oil-95212
08/08/2025, 12:52 PMprehistoric-airplane-85682
08/08/2025, 2:25 PMsilly-oil-95212
08/08/2025, 6:11 PMprehistoric-airplane-85682
08/08/2025, 6:33 PMjs
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!