https://discord.gg/botpress logo
Exact JSON Payload needed to satisfy the standard ...
# 🤝help
a
Hi Devs, I've successfully implemented a headless chat architecture: React Native App = Supabase Edge Function = Botpress Messaging API.Text messages flow perfectly, i m using chat integration. My final roadblock is File Uploads. My Botpress flow relies on the standard Capture File card to pause the workflow, receive a file, extract its URL, name and type, and store it in a variables. Goal: I need to make the API message sent from my Edge Function appear to Botpress exactly like the drag-and-drop action in the Emulator. THE QUESTION: how to do that ?
hi @wide-umbrella-5226 sorry on @ you on this but we are stuck with my colleagues xD
w
i don't understand your problem
what part of the file upload workflow are you having issues with?
capturing the uploaded file?
a
the caputre file works perfectly in the botpress emulator or webview
the problem is with the bot integration with my app
i need to build the concept of uploading a file through my app but with taking in mind that it should work like in my botpress workflow
i might be wrong on this one, maybe there is another way on how to do that, but my logic is since the worklow was build to work with what the capture file card do i m trying to recreate the same thing with the code of my app
@wide-umbrella-5226 ❤️
l
Continuing our conversation from the AMA
w
well i can't really help you with that
sounds more like a react thing
than a botpress one
also i don't know react lul
l
(testing the limitation of botpress docs AI) - Upload the file and obtain a public or signed URL. - Call the Botpress Messaging API (POST /api/v1/bots/:botId/converse/:sessionId) with a type: "file" message. - The payload must contain the properties described in the docs:
Copy code
{
  "type": "file",
  "payload": {
    "fileUrl": "https://my-storage.example.com/path/to/file.pdf",
    "filename": "file.pdf",
    "content_type": "application/pdf"
  }
}
- Botpress will set event.type to "file" and expose the values: {{event.payload.fileUrl}} – the file URL. {{event.payload.filename}} – the file name. {{event.payload.content_type}} – MIME type. - In your Capture File card, simply reference the variables above (e.g., {{event.payload.fileUrl}}) to store the URL, name, and type in workflow variables.
a
i will try this theory
l
Let me know 😄
a
thanks for the help buddy
w
if you just want to emulate the receiving the file part then it's easy as ross showed
but if you want to emulate the UPLOAD REACT COMPONENT then i can't help you
i need to recreate this using my app
in my app i can send messages to botpress but i dont know exactly how i manage sending files
w
well there are several ways
you can upload it through the client using an execute code card or upsert the file from the api endpoint
a
I think i found a solution, using the capture file is too much complicated cause i need to take in mind that the user can access my botpress using an app or a website or my db, so i will juste use instead an execute code card to manually resolve this problem using code
hi @loud-crowd-60573 this solved the problem i have recreated the capture file card in code so i can customize it to handle my whole set of integrations outside botpress in an execute code card
2 Views