How it Works
The PPTX export process involves two main steps and is designed to keep your API keys secure:- Frontend Trigger: The user initiates the export from the UI. The
<C1Component>provides aexportParamsstring to a callback function in your code. - Backend Endpoint: Your frontend sends these
exportParamsto a dedicated endpoint on your own backend. Your backend then securely calls the C1 PPTX Export API with your API key and streams the resulting PPTX file back to the user’s browser for download.
You must create a backend endpoint. The C1 PPTX Export API should not be called directly from the frontend as it would expose your secret API key.
Implement the Backend Endpoint
Your backend needs an API route that will receive the request from your frontend, call the C1 API, and forward the PPTX response. PPTX Export API Endpoint:POST /v1/artifact/pptx/export
app/api/export-pptx/route.ts (Next.js App Router)
Implement the Frontend Handler
The<C1Component> provides an exportAsPPTX prop, which accepts a function. This function is called when the user clicks the export button in the artifact’s UI. It receives the exportParams and a suggested title for the file.
Your implementation should call your backend endpoint and use the response to trigger a file download in the browser.
Usage with <C1Chat>
You can also enable PPTX export in a conversational context. The exportAsPPTX function can be passed via the customizeC1 prop to either <C1Chat> or the useThreadManager hook.