Passing dynamic image array to Shopify Create Product API from Google Drive via Claude AI

,

:bullseye: What is your goal?

Hi Im very new but using AI to help me build an automated product listing tool for my Shopify store.

I can get it working up until loading up the images.

Don’t know if I am overcomplicating this or there is an easier way anyway this is where AI has got me.

The workflow is:

Google Drive folder is detected with product photos
Photos are downloaded and uploaded to Anthropic Files API
Claude AI analyses the images and returns product listing data as JSON
A Shopify product is created via REST API call

:thinking: What is the problem & what have you tried?

The problem: My Text Aggregator builds Google Drive public URLs like {“src”: “https://drive.google.com/uc?export=download&id=FILE_ID”} for each image. When I pass this into the Shopify REST API body as the images array, I get a 400 error.

:clipboard: Error messages or input/output bundles

The images array in the body looks like this:
“images”: [{“src”: “https://drive.google.com/uc?export=download&id=ABC123"},{"src”: “…”}]
Question: Is the Google Drive URL format compatible with Shopify’s product images API? Do I need to use a different URL format, or do I need to host the images somewhere else first before passing them to Shopify?

Hello,

Your files need to be publicly accessible.

If you are using the Google Drive Download a File module, it works based on your account permissions → so access is not an issue in that case.

However, Shopify is not authorized to use your Google Drive permissions, so the file must be public to bypass Google’s sharing restrictions.

Try using the Get a Share Link module beforehand and make sure the file permissions are set to public.

This should resolve the issue as in most cases Shopify works with Google Drive URLs as long as they are export=download.

And to make files private again- you can use once again Get a Share Link module- this time with restricted access level.

Yeah you are overcomplicating things. If you are new to this, then I suggest using the built in modules and not generic API calls with bodies that an LLM provided.

Also Shopify switched to graphql from rest API.

1 Like

Thanks I thought so, but for some reason there were some limitations to this (according to my AI helper and after 3 days I can’t remember exactly). Maybe something around reading all product images together to create the correct data in product draft. So each product has say 7 photos and it needs to read them all together to create the correct data. Thanks for your response, I don’t know what I am doing really just doing what AI is telling me to but I seem to be getting closer. Sure ive gone a very very long way around.

Welcome to the Make community!

You probably need an aggregator. How does the Shopify Create a Product module look like? Does it take an array of images, or you’ll have to upload them individually?

Combining Bundles Using Aggregators

Every result/item from some module types (like Trigger / Iterator / List / Search / Match modules) can potentially and likely output more than one bundle. These multiple bundles will individually run subsequent modules once per bundle, which is not optimal in most cases:

  • one operation per bundle per module, which could lead to…
  • use of multiple credits per bundle per module (some modules use more than one credit)
View example screenshots

Aggregator Example

The “Search Rows” module runs one time, returning 999 results (999 bundles).

  • Without Aggregator: the tools module run 999 times (999 operations)


    (and if there are more modules, they run 999 times each)

  • With Aggregator: the tools module only runs 1 time (1 operation)

:warning: Warning: :police_car_light:
This can easily use your entire quota of credits if you are not careful or fail to understand this concept.

To “combine” multiple bundles into a single variable, so that you can process all of the items in a single operation, you’ll need to use an aggregator. Aggregators is a type of module that accumulates bundles and outputs one bundle (unless you are using “Group By”). An example of a commonly-used aggregator module is the Array aggregator module.

You can find out more about some other aggregator modules here:

Question: Which is the best aggregator do you think you’ll need for your use-case?

Setting the Correct Aggregator Source

You need to set the “Source Module” field of the aggregator to where the bundles are coming from. This is usually an iterator module, but can also be a search/list/repeater module, or even the trigger module!

Mapping a Complex (Collection) Structure Into an Array Field

The Array Aggregator module is very powerful because it allows you to build a new complex array of collections that matches a later module’s array field to map multiple items (collections) to it. Such fields initially may allow you to manually add individual items, but toggle the “Map” switch on, and you can map an array variable (from an Array Aggregator) containing multiple collections.

Simply select the respective “Target structure type” in an Array Aggregator module.

As you can see from the example above, the “Map” toggle on complex array fields are used when you have an array variable (like from an array aggregator).

:clipboard: Note: :light_bulb:
Other combinations of modules may also allow you to generate an array that matches a future module field’s array structure, like “Aggregate to JSON + Parse JSON”, or “Create JSON + Parse JSON”, but this is an advanced topic.

Question: Are you mapping your array into a field that accepts more than one item/collection?

For more information, see “Mapping with arrays” in the Help Centre. I also suggest going through the Make Academy, which also covers the use of Iterators & Aggregators.

@samliew
P.S.: investing some effort into the tutorials in the Make Academy will save you lots of time and frustration using Make!

Shopify usually wants the image src to be a direct public image URL.

Google Drive links often do not behave like normal image file links, even if they open in the browser. So Shopify may reject them because the file is not being served the way it expects.

So yes, that is likely the issue.

I’d try hosting the images somewhere with a real direct file URL first, then send those URLs to Shopify. Google Drive is often unreliable for this kind of use.