How to merge connection credentials with external JSON data in custom app?

Hello,

I’m developing a custom Make.com app and have a technical question about the “Make an API Call” module.

My situation:

  1. Connection provides some required fields (e.g., API credentials) - {{connection.field1}}, {{connection.field2}}

  2. External source provides additional fields (from webhook, previous module, or parameters)

  3. Need to merge both into a single request body automatically

Desired result:

json

{
  "field1": "{{connection.field1}}",     // From connection (secure)
  "field2": "{{connection.field2}}",     // From connection (secure)
  "field3": "value3",                    // From external source
  "field4": "value4"                     // From external source
}

The names of fields (fields3, field4) could be with any name, unable to predefine them.

What I tried:

Using merge() with temp directive, but encountered errors - functions like object() and toObject() don’t exist in Make.com IML.

Question:

What’s the proper approach to automatically combine connection fields with dynamic parameters in a custom app module? Should users manually map all fields (including connection credentials) via collection parameters, or is there a way to pre-populate connection fields automatically?

Thank you!

Hi everyone,

I managed to solve this issue! The key was understanding the order of fields in the body object.

json:

{ “temp”: { “externalData”: “{{if(length(parameters.additionalFields) > 2; parseJSON(parameters.additionalFields); {})}}” }, “url”: “{{parameters.endpoint}}”, “method”: “{{parameters.method}}”, “body”: { “field1”: “{{connection.field1}}”, “field2”: “{{connection.field2}}”, “{{…}}”: “{{temp.externalData}}” }, “response”: { “output”: { “body”: “{{body}}”, “statusCode”: “{{statusCode}}” } } }