Mapping the output of Http > GetFile to a different object structure, while keeping data as 'Binary Data'

Hi. I am trying to map the output of an Google Drive > Download File, to be able to pass it to the Mailgun > Send Email > Attachments field.

From what I’ve understood, the Mailgun > Send Email > Attachments field expects this datastructure:

[ { filename: "fileName:", data: BINARY}}

Google Drive > Download File has a different file structure, as per below.

The ‘Data’ field type is Binary, as indicated by the red arrow abve.

I have multiple files to download, so I am also using an Array Aggregator in the end to group them into an array.

In order to map the datastructure, I am using Create JSON Module and Parse JSON. The problem seems to be the data type. Converting to/from JSON, it becomes a long string. I’ve tried both codepage of ‘binary’ and ‘utf8’.

Image above shows the mapping for Create Json.

Image above shows the output of the Parse Json.

While using the above, the Mailgun > Send Email works, so it seems the mapping is working fine - The issue is that the attachments sent are corrupted. I am assuming it is because of the data type.

Is there any way how I can map to JSON and back, and have the output just like shown in the Google Drive module, as “buffer/binary” rather than Long String?

Or is there any way to directly map the output of Google Drive > Download file to a different object structure, without having to convert and parse to/from JSON?

Regards,
Karl

Welcome to the Make community!

This seems like a complex scenario you’re trying to make, perhaps exporting the blueprint might help others replicate the issue to be able to answer your question.

At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826

Uploading it here will look like this:

blueprint.json (119.3 KB)

2 Likes