Get files data from a nested collection

Hi Makers,

I’m getting a couple of Files from a Webhook. Each category will have 1 file only, in the screenshot below im showing the msaFiles Category, which has 1 file (and my asumption is that there will always be only 1 file per category).

While I can probably map the File Data and Name directly to my next upload modules, lets start with adding them as variables:

My questions are as following:

  1. Not sure why I have the file Data and Name appearing twice on the webhook, once directly under msaFiles and once under msaFiles/files.
  2. Either way how can I map the relevant file data and name to the next module? I’m missing something…

Here is a fresh Webhook Output:

[
    {
        "msaFiles[]": {
            "name": "Just a Word Document.docx",
            "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
            "data": "IMTBuffer(13338, binary, 1f8f4d23a54e043d57102c673f303c8bb1d6bc2e): 504b030414000600080000002100dfa4d26c5a01000020050000130008025b436f6e74656e745f54797065735d2e786d6c20a2040228a0000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "files": [
                {
                    "name": "Just a Word Document.docx",
                    "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                    "data": "IMTBuffer(13338, binary, 1f8f4d23a54e043d57102c673f303c8bb1d6bc2e): 504b030414000600080000002100dfa4d26c5a01000020050000130008025b436f6e74656e745f54797065735d2e786d6c20a2040228a0000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
                }
            ]
        },
        "ItemID": "6309489247",
        "FirstName": "John Wu ",
        "CompanyName": "Whatever",
        "Country": "Singapore"
    }
]

I have tried mapping in several ways but keep getting an empty result, Any direction would be highly appreciated :innocent:

Hmm… @OmriNyx; I tested using your data a few differing ways, and got empty results too.

Even at the first filter after the webhook, the file data is gone.

Here’s my test scenario.
blueprint (2).json (23.3 KB)

Thanks @ImMichaelCannon Seems like some mapping issue, Let’s see if anyone from the community can point us in the right direction.

P.s. Nice screen capture :desktop_computer: :100:

1 Like

@OmriNyx; if you’ve a Make Enterprise plan, the support team is really good about helping with this stuff.

FWIW I’m one of those folks that has to worry about trimming 30% of operations off of a 40 operation scenario because as things scale, we breach 2M ops a month.

1 Like

Hi @OmriNyx,

This is not really a bug with Make.

Square brackets in JSON key names are very bad, it shows poor webhook design.

To get around this, you will need to set the Webhook “JSON Pass-through” to YES (it is “No” by default), when creating or editing a webhook.

Then, you will be able to replace the square brackets in a Parse JSON module.

Screenshot_2024-08-15_130856

Then, mapping the msaFiles variable (now without the square brackets), won’t have any further issues and will contain the values.

Screenshot_2024-08-15_130820

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

Click to Expand Module Export Code

JSON - Copy and Paste this directly in the scenario editor

{"subflows":[{"flow":[{"id":132,"module":"json:ParseJSON","version":1,"parameters":{"type":""},"mapper":{"json":"{{replace(1.value; \"/\\[\\]\"\":/g\"; \"\"\":\")}}"},"metadata":{"designer":{"x":683,"y":-311,"name":"Webhook Square Bracket Fix"},"parameters":[{"name":"type","type":"udt","label":"Data structure"}]}}]}],"metadata":{"version":1}}

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

4 Likes

Hi @samliew ,

Many thanks for the direction. I handled the Webhook structure so it wont send and when this was solved it seems like I can map the Output directly to the next Input without issueד:


Thank you very much, Case Closed ! :hammer: :100: :star_struck:

2 Likes

Thanks, @samliew, for the help here. I appreciate the chance to learn too.

2 Likes