How to upload a Facebook ad image using HTTP module? (Facebook Marketing API)

I am trying to create a scenario to create new Facebook Ads campaigns via API.

I do not understand APIs and HTTP, but I successfully created the campaigns and ad sets with the HTTP module.

The problem is I am stuck in the ad creation.

The ideal scenario will read a Google Drive folder with images and videos and then upload it to the Facebook Media Library to generate an image hash that will later be used to create the ad creative.

At least, that is what I understood from the API documentation at step 4 - link here

I’ve tried using the Graph Explorer and HTTP request in Make, but I can’t understand why it is not working!

The image below is part of the scenario I have and encompasses just the ad creation part, where I am having problems.

The settings:


This image is the whole scenario working up to the Google Drive Search for Filing module.

I first tried to create the scenario without the HTTP Get Files module, but it did not work. Then, I tried to download an image using the Get File and then made a POST request to upload it, but it still did not work.

The error I get is this:

I have no idea if Facebook allows me to create an ad using HTTP, if I am doing something wrong, or if the Get File image output is an image format that Facebook does not accept… I am lost.

How do you upload a Facebook ad image using the HTTP module? Thanks!

hi,

  1. what’s the files format?

  2. is your google drive image publicly readable? you need to set the visibility to anyone. does your get a file module show the correct image you want? trying sending it via mail e.g. to test

2 Likes

Hi Karim,

  1. I tried png and jpeg.

  2. The root folder and the file itself are public to anyone.

I think the Get a File shows the correct image. The Output comes with a data field in binary format, and the filename is the file name file I want.

The URL I am using from Google Drive is in the following format, but I also tried all the fields the Google Drive module returned.
https://drive.google.com/uc?export=download&id=1<IMAGE_ID> and even tried uploading it to my website/domain. Nothing worked.

And yes, I was able to get the image in my email. As per your suggestions, after the Get a File I sent both images, PNG and JPEG, and both arrived in my Gmail.

Are you sure the image data go into the filename: key? Seems like that would be a string and the image data would go elsewhere. Just a guess here.

4 Likes

Also since you already have a reference to a searched file in Google Drive, you should use the Google Drive “Download a file” module, since the file might not be publicly shared yet, which means the HTTP Get a File could possibly return a non-file.

3 Likes

Thanks for the replies, guys.

I figured it out earlier today. I am not sure if it’s the best solution, but the problem was in HTTP Body Type.

To send files, the Body Type must be “Multipart/form-data,” not “Raw”. Then, you need to map the fields accordingly.

The HTTP Get a File and the Google Drive Download a File had the same output - an image in binary format. Maybe both would work, not sure.

Can I mark my answer as a solution? :sweat_smile:

2 Likes

Hello @alexandr.e :wave:

Just stepping in to congratulate you on solving your troubles with some assistance from @alex.newpath and @samliew.

Thank you very much for coming back here and sharing the details of your solution with us. We appreciate you keeping our community neat and tidy for others.

Keep up the good work! :meow_party:

2 Likes