Gmail module passes .json file error

:bullseye: What is your goal?

When a Survey123 form is submitted, a gmail module is triggered to send an email with the form data filled and all uploaded files (.pdf, .png, .jpg, etc) are added as attachments.

Current scenario: Watch Survey123 → HTTP download → Gmail

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

Originally the files emailed fine, but after this past Monday (January 26) the form data is emailed fine and the attachments now only come through as .json error files. See screenshot below

I have tried:

  • chaning the size of allowable attachments on Survey123
  • deleting and re-adding the modules
  • deleting and recreating the webhook
  • deleting and recreating the connection
  • deleting and recreating the scenario
  • changing the owner of the Survey123 form

:clipboard: Error messages or input/output bundles

{"error":{"code":400,"message":"","details":["This operation is not supported."]}}

This code is attached in each test email as a .json file, one for every HTTP module I add in the scenario. The screenshot below shows one .json attachment because that version of the scenario had one HTTP module.

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

1 Like

Further documentation:

Example of successful email generated via Make scenario

Screenshot of built Survey123 user end

Backend of Survey123

Current scenario setup

1 Like

Hi @Scott_Barrell

I can’t see how you’re mapping the results of the Survey123 app to the HTTP request, but I would guess that maybe you are using the wrong URL.

First of all, you don’t need a HTTP module for each file. The “Survey123 Watch Survey” module outputs an array named attachmentInfos[] that contains an object for each file. Just iterate that array and get the files via HTTP download. Then aggregate and map the aggregated array as Gmail attachment.

Something like this:

If you use another URL, that might be the problem.

Don’t forget to set the Source module of the aggregator as the iterator and the target structure as the gmail attachment.

Does that help?

@damato

1 Like

I’ve adjusted the scenario to my understanding of your advice, and I’m still receiving a .json file.

I’ve made the scenario public; do you mind checking the variables etc to see what it is that I’m missing?

Thanks for your assistance

1 Like

Hello @Scott_Barrell,

You are mapping the wrong array in your iterator module.

Please try changing from:

{{2.attachmentInfos}}

to:

{{2.attachmentInfo.attachments}}

Correct setup:

attachmentInfo array stores info about all attachments with signature. attachments array stores everything uploaded with the form.

Hope it helps!
Have a nice day,
Michal

Hi Michal,

Thanks for the advice. I appreciate the feedback; unfortunately it only half-solved the problem. With your changes the email successfully sends with a single attachment, but not multiple including the customer signature which is necessary. Do you have any ideas on how to get this to send all attachments?

1 Like

Thanks for the feedback!

Now I see a completely different set of sample data in your scenario.
Unfortunately, I don’t have access to Survey123 to send dummy data to my Make workflow.

To suggest a better solution, please let me know:

  1. Are all attachment fields single-item, or can users send multiple files in one field?
  2. Could you please send me sample output data from the Watch Survey module (use dummy data for submission)?

Why I’m asking - if the attachmentInfo array adds new arrays for each field used, your mapping was correct and the only error I see now is incorrect mapping in the Send an email module.

But if attachmentInfo stores only some fields and the rest is stored in {{2.attachmentInfo.attachments}}, it will require a completely different approach.

What else you can do right away

Change the mapping in the iterator back to:

{{2.attachmentInfos}}

and in the Send an email module, toggle on the Map switch for Attachments and map it to Array output:

{{6.array}}

If each field stores only one file and all attachment fields are listed under attachmentInfos array it should solve your issue.

Hi, just checked back in.

Your scenario seems to be correct.

attachmentInfo and attachmentInfos contain the same data. The difference is the structure:

The first one is a Collection of Arrays containing a single Collection each (complex).
The second one is an Array of Collections (one collection for each attachment).

I’d stick with the latter.

I just used your scenario, set my connections to Survey123 and Gmail, and it worked perfectly.

What is the output of the Survey123 module?

What is the result of the Aggregator? Can you see the file name?

Thanks for reviewing again! I’m going to take a look at what’ you’ve written and attempt to parse it.

No, I cannot see the result of the Aggregator as per your screenshot. Are you a paid subscriber? We might be missing that functionality in that case.

Also, the Survey123 test is giving this error. It still successfully triggers the make scenario/Gmail module, but this seems relevant.

You were right to ask about the HTTP module; the url is not working like you describe. I’m not sure what else to do there because someone else that that was the correct item to have.

Hey Scott,

can you show a screenshot of what the Survey123 module returns as output? Cause that error suggest you cant download files using the link you mapped in the Get a File module. Maybe the links are temporary and expire after some time?