Need config for Set variable module to fetch ad id, creative id ,image hash & video id

:bullseye: What is your goal?

Want to get ad id, creative id ,image hash & video id from data received from http response to facebook graph api

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

not able to map data from http response coming from facebook graph api to a variables which can later be used to put in google sheet

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

su.blueprint.json (34.6 KB)

Hey Rajat,

can you share a screenshot or if possible even copy/paste the output bundle of the HTTP module here?

This is the response from http module. I want to finally update google sheet with multiple rows .each having ad id, creative id,video id&image url. Please help

It looks like the variables are already inside. Is the module not returning the JSON parsed? What do you see when you try to map from it?

I am getting a parsed response from server. When I use map on the data response in set variable module , it gives me only ad id.

formula for set variable module-
{{map(keys(21.data); “ad_id”; item); map(keys(21.data); “body”; first(get(21.data; item + “.creative.asset_feed_spec.bodies”)))}}

this is how my set variable module output looks like-

It doesn’t look like its an array though, map() wont work. This looks like a collection of collections. So you can either use the values directly or change the top most collection in an array first.

1 Like

now i have dataarray which has key &value as shown in pic attached. Still map() doesnt work,

Is this because array still has collections inside and not objects?

OK now which items are you trying to get from that array?

need ad id,creative id, image hash & video URL for all items which can be updated in google sheet

something like this -
map(http.data;

{
““ad_id””: item.id;
““ad_name””: item.name;
““status””: item.status;
““image_hash””: ifempty(item.creative?.image_hash; null);
““video_id””: ifempty(item.creative?.video_id; null)
}

)

So you want to create an array with less items inside?

The map() function wont work here, since it creates an array with one item inside. You can try with an iterator followed by an array aggregator or aggregate to JSON module to rebuild the array with only the items you want in it.

1 Like