Upload from Zoho Creator File Upload field to OpenAI Vector Store

Upload from Zoho Creator File Upload field to OpenAI Vector Store

I’ve struggled for quite a while to get this working properly.

For a long time we relied on Azure Functions as a workaround to handle file transfers between Zoho Creator and OpenAI Vector Stores. It worked, but added unnecessary infrastructure and complexity.

After a lot of trial and error, I finally got a fully working, direct solution using:

  • Zoho Creator invokeurl

  • Creator file download API

  • OpenAI Files API

  • OpenAI Vector Store API

No external middleware required.

Below is the working function.

  1. map SaveUploadToVectorStore(string report_link_name, string record_id, string filename, string vector_store_id)
  2. {
  3. // Download a file from current app
  4. download_url = "https://creator.zoho.eu/api/v2" + zoho.appuri + "report/" + report_link_name + "/" + record_id + "/File_upload/download";

  5. downloaded_file = invokeurl
  6. [
  7. url :download_url
  8. type :GET
  9. connection:"zohocreator"
  10. ];

  11. // Ensure correct filename
  12. downloaded_file.setFileName(filename);

  13. // Upload to OpenAI
  14. multipart_parts = List();
  15. multipart_parts.add({"paramName":"purpose","content":"assistants","stringPart":"true"});
  16. multipart_parts.add({"paramName":"file","content":downloaded_file});

  17. upload_resp = invokeurl
  18. [
  19. url :"https://api.openai.com/v1/files"
  20. type :POST
  21. connection:"openai_connection"
  22. files:multipart_parts
  23. ];

  24. file_id = "";
  25. if(upload_resp != null && upload_resp.containKey("id"))
  26. {
  27. file_id = upload_resp.get("id");
  28. }

  29. // Attach to vector store
  30. if(file_id != "")
  31. {
  32. attach_headers = Map();
  33. attach_headers.put("Content-Type","application/json");
  34. attach_headers.put("OpenAI-Beta","assistants=v2");

  35. attach_body = Map();
  36. attach_body.put("file_id", file_id);

  37. invokeurl
  38. [
  39. url :"https://api.openai.com/v1/vector_stores/" + vector_store_id + "/files"
  40. type :POST
  41. connection:"openai_connection"
  42. headers:attach_headers
  43. parameters:attach_body.toString()
  44. ];
  45. }

  46. result = Map();
  47. result.put("file_id", file_id);

  48. return result;
  49. }

Key prerequisites

For this to work, you need:

  1. A Zoho Creator OAuth connection

    • Must have permission to download files from your app.

    • Used in the invokeurl download call.

    • Example link name: "zohocreator"

  2. An OpenAI API Key connection

    • Connection type: API Key

    • Header:
      Authorization = Bearer <your_openai_key>

    • Example link name: "openai_connection"

  3. Correct region

    • Adjust creator.zoho.eu if you are using .com, .in, etc.

  4. Correct report link name

    • The report must expose the File Upload field.

  5. Use actualname
    Zoho prepends a unique ID to uploaded files.
    Use:

    filename = input.File_upload.actualname;

    This removes the internal prefix and ensures the correct file extension (e.g. .pdf) is preserved.
    Without this, OpenAI may receive the file as "content" and reject it with File type not supported.


    Access your files securely from anywhere

        All-in-one knowledge management and training platform for your employees and customers.






                              Zoho Developer Community




                                                    • Desk Community Learning Series


                                                    • Digest


                                                    • Functions


                                                    • Meetups


                                                    • Kbase


                                                    • Resources


                                                    • Glossary


                                                    • Desk Marketplace


                                                    • MVP Corner


                                                    • Word of the Day


                                                    • Ask the Experts





                                                              Manage your brands on social media



                                                                    Zoho TeamInbox Resources



                                                                        Zoho CRM Plus Resources

                                                                          Zoho Books Resources


                                                                            Zoho Subscriptions Resources

                                                                              Zoho Projects Resources


                                                                                Zoho Sprints Resources


                                                                                  Qntrl Resources


                                                                                    Zoho Creator Resources



                                                                                        Zoho CRM Resources

                                                                                        • CRM Community Learning Series

                                                                                          CRM Community Learning Series


                                                                                        • Kaizen

                                                                                          Kaizen

                                                                                        • Functions

                                                                                          Functions

                                                                                        • Meetups

                                                                                          Meetups

                                                                                        • Kbase

                                                                                          Kbase

                                                                                        • Resources

                                                                                          Resources

                                                                                        • Digest

                                                                                          Digest

                                                                                        • CRM Marketplace

                                                                                          CRM Marketplace

                                                                                        • MVP Corner

                                                                                          MVP Corner









                                                                                            Design. Discuss. Deliver.

                                                                                            Create visually engaging stories with Zoho Show.

                                                                                            Get Started Now


                                                                                              Zoho Show Resources

                                                                                                Zoho Writer

                                                                                                Get Started. Write Away!

                                                                                                Writer is a powerful online word processor, designed for collaborative work.

                                                                                                  Zoho CRM コンテンツ




                                                                                                    Nederlandse Hulpbronnen


                                                                                                        ご検討中の方