Make.com Make Code How to Run Custom Code Directly in Your Scenario
You need to extract a name, phone number, and email from an incoming email. In Make.com, you could use three separate Regex modules - but each one costs a credit. Run that scenario 100 times a day and you’re burning 300 credits on something that could be one.
Make Code solves this. It lets you run JavaScript or Python directly inside your scenario - one module, one credit, any logic you need.
What Is Make Code
Make Code is a built-in Make.com module that executes code as part of your scenario. You pass in data, the code processes it, and the result comes back in a variable called Result. From there, you use it just like any other data in the next modules.
You don’t need to write the code yourself. AI handles that in seconds.
When to Use Make Code
Make Code is worth reaching for in three situations:
- Text parsing - extracting multiple values from a single text block at once
- Credit savings - combining several operations into a single module
- Complex transformations - logic that goes beyond what native IML functions can handle
For simpler transformations - like working with dates or generating a unique code with one formula - native IML is faster. Make Code shines when you need more.
How to Add Make Code to a Scenario
- Click + in the scenario editor to add a module
- Search for “Make Code” - it’s under Built-in apps
- Choose a language: JavaScript or Python
- Paste your code into the Code field
- Set up Input at the bottom - the data you want to pass into the code
💡 Not sure what to pass as Input? Run the scenario once without Make Code and check what the previous module returns. That tells you exactly what you’re working with.
Passing Input Data
You define Input as variables. To pass email body text:
input1 = {{1.body.text}}
Inside the code, access it as input1:
const text = input1;
Practical Example - Email Parsing
You have a registration email and want to extract name, email, and phone. Normally: three Regex modules. With Make Code:
const text = input1;
const name = text.match(/Name:\s*(.+)/)?.[1]?.trim() || '';
const email = text.match(/Email:\s*(\S+@\S+)/)?.[1]?.trim() || '';
const phone = text.match(/Phone:\s*([\d\s+\-()]+)/)?.[1]?.trim() || '';
return { name, email, phone };
One module. Three values. One credit.
⚠️ Regex patterns are sensitive to input format. If the email format varies, adjust your patterns or add fallback values (the
|| ''above does this).
The Result Variable
Make Code output always lands in Result. Return a JSON object and you get nested access: Result.name, Result.email, Result.phone. Return a plain value and Result is that value directly.
Always return a JSON object when you need multiple outputs. It’s cleaner and easy to map in downstream modules.
Using AI to Write the Code
No JavaScript or Python knowledge needed. The process:
- Tell AI what you need: “Write JavaScript for a Make Code module that extracts name, email, and phone from text using regex.”
- Include a sample input
- Specify the expected output format
Paste the code into the module, set Input, run it. If something breaks, copy the error back to AI - it usually fixes it on the first try.
Common Mistakes
Result is empty - make sure your code has a return statement. No return, no output.
“input1 is not defined” error - you forgot to set the Input variable in the module settings.
Scenario stops at Make Code - syntax error in the code. Paste it into AI and ask for a fix.
Unexpected Result format - add console.log(JSON.stringify(result)) and check the logs to see what the code is actually returning.
Summary
Make Code is one of the most useful tools in Make.com once you move past basic scenarios and start working with more complex data. It saves credits, simplifies your scenario layout, and with AI you don’t need to know how to code.
Start with a simple case - process one API text output - then build from there. For advanced array processing in Make, check out how the iterator works.
Drop me a note on how it goes - find me in Make Community.