https://discord.gg/botpress logo
Generate documents within chat on the fly
# 🤝help
b
I want to be able to generate documents within a chat, IE like chatgpt to generate an excel document or a word doc. Would this be generate text and tell to summarise, I am new to this so just trying to get my head around it. As some of the documentation in the botpress site seems abit out dated.
p
You can only output pdfs. You can also modify existing google sheets. The generate text cards will create text on the topic of your choosing but will not output it in a document format.
b
Hi Leanne, thanks for that, I find that interesting as im using LLMS Chat gpt 5 which can output those file tyres on the fly, so was thinking maybe using an action or summary card to mayb upload and then inject. // actions/makeDocx.ts import { Document, Packer, Paragraph, TextRun } from "docx"; export default async ({ title, body }: { title: string; body: string }, { client }) => { // Build a simple DOCX in-memory const doc = new Document({ sections: [ { children: [ new Paragraph({ children: [new TextRun({ text: title, bold: true, size: 32 })] }), new Paragraph(body), ], }, ], }); const buffer = await Packer.toBuffer(doc); // <- Buffer of the .docx // Upload to Botpress Files (make it public so you can share the link) const file = await client.uploadFile({ key:
exports/${Date.now()}.docx
, content: buffer, accessPolicies: ["public_content"], // permanent public URL }); // Return the URL so the workflow can send it to the user return { url: file.url }; };
4 Views