Post: Code by Zapier: Add custom code to your workflows

Code by Zapier: Add custom code to your workflows

One of the biggest advantages of using Zapier to automate your work is that you don’t need to use code. You can create zips (our word for automated workflows), Formagents, Chatbotsand Tables Without knowing any programming language.

There may be a time, however, when you need to do something a little more advanced. Maybe you know exactly what you want to automate, but Zapier’s current actions or triggers can’t do it. Or maybe you’re getting information from App A, but it’s not in the right format for App B, and would otherwise take too many steps to get there.

Right there Code by Zapier comes It’s a built-in tool specifically for adding “code” to “no code,” so you can fully customize your workflows—and even shape AI-infused data, such as formatting AI output or adding guards to keep content consistent. And here’s the twist: you don’t need to know a lick of code to use Code Steps. Interesting let’s dive in.

New to Zapier? It’s workflow automation software that lets you focus on what matters. Combine user interfaces, data tables, and logic with thousands of apps to build and automate anything you can imagine. Contact sales to learn more.

Go ahead

What is Code by Zapier?

Code by Zapier lets you Add custom code to your zips so you can perform specific tasks that go beyond pre-built triggers and actions Provided by Zapier’s existing integration.

Code steps work like any other trigger or action, with one key difference: you tell these steps what to do. The python or JavaScript. These extra instructions inside your zip can be useful when you need to do something more advanced that zippier doesn’t natively support. You can, for example, use code steps to implement complex Lookup tablesaction Line itemsclean the raw data eg XMLor retrieve dynamic dates from your data.

When used as a trigger, code through Zapier typically checks for input data or specific conditions to decide whether a workflow should start. As a process, it allows you to write code that will interact with data coming from a trigger or previous action step. Steps using code can process information, reorder data, or retrieve data from an API before sending it to subsequent steps in your ZAP.

Note: Zips work one step at a time, starting with the top trigger. Make sure your code action is placed below The trigger or action you want to use and collects it above Any activity that may require its data.

And if you don’t know how to code – or you just get stuck – you can Use AI Create code snippets directly within the ZAP editor by simply specifying what you want to do.

In essence, Code Steps allows you to fully customize your workflows and take your business processes to the next level.

Key features include:

  • Custom Scripts: Write JavaScript or Python code to run custom logic or operations that are not supported by the standard Zapier integration.

  • Data manipulation: Change, format, or modify data from previous ZAP steps to meet specific requirements.

  • Variable support: Use variables to store and manipulate data in your script, making your code more dynamic and adaptable.

  • Built-in Python utilities: Store and retrieve data between ZAP storeclientsend with HTTP requests Application utility, and use the print utility to debug your function during execution.

  • Built-in JavaScript utilities: Store and retrieve data between ZAP storeclientuse callback functions to handle tasks that take time to complete, make HTTP requests recovery utility, and debug your function with console.log.

  • AI Code Generator: Describe how you want to customize your trigger or action (in plain English), and the AI ​​will write the JavaScript or Python code for you.

  • Testing and Debugging: Run your zip Dashboard To verify the behavior you expect and to check your .. History of zip For information around your code including input data, output details, and logging.

What you can do with code with Zapier

With Code by Zapier, the possibilities are endless. While most use cases will depend on your unique business challenges, here are some popular examples.

Send scheduled HTTP requests to an external API

You want to send or retrieve data from an app that doesn’t have native Zapier integration.

What it might look like:

  1. a The zip is activated every hour Scheduled by Zapier.

  2. A code in the Zapier step sends a custom HTTP request to the external API endpoint and parses the response.

  3. The parsed API response is used to add or update a row in a Google Sheet.

Parsing and Transforming Slack Messages with JavaScript

You want to extract and clean specific data from Slack messages before sending them to another app, without relying on multiple formatter steps.

What it might look like:

  1. A new message has been posted to a Slack channel.

  2. A code by Zapier analyzes the message text, removes user mentions, and extracts relevant content using Regex.

  3. The cleared message text is sent to the air table as a structured field in a new record.

A zip that uses code by the zippier step

Note: For most single-step transformations—such as splitting a field, finding and replacing values, or adjusting case—you can use The formatter Instead, code steps are for you if you need more control or complexity, such as combining multiple adjustments into a single step that might otherwise require multiple formatter action steps.

Timestamp normalization for table storage

Your incoming table records use ambiguous or inconsistent date formats, and you want to ensure that timestamps are stored consistently.

What it might look like:

  1. A record is added or updated in Zapier tables.

  2. A code in the Zapier step explicitly parses the incoming timestamp and converts it to UTC in ISO 8601.

  3. Timestamps are routinely written to Zapier tables by updating common records.

Indications: If you’re struggling, try coding communities Stack Overflow or The Zapier Community Great for getting help from other coders to fix your code or fix bugs.

How to Get Started with Code with Zapier

Want to try the code step by step?

To use the code as a trigger, follow these steps:

  1. i Zip editorclick the trigger step, then find and select Code by Zapier.

  2. Click the Event drop-down menu and select Run JavaScript or Run Pythonfor , for , for , . Then click Continue.

    Zapier editor that displays code via Zapier, Run JavaScript with a menu listing the Trigger event and Run Python options
  3. i formation Tab, use Code Field to enter your JavaScript or Python code.

    Zapier Run JavaScript step showing the code editor with a sample return object and generating a purple color with an AI button
  4. If you want it to write the code for you, click Create with AI. In the dialog box, enter a prompt that describes the code you want. click Generate the codethen click Use the code.

    A screenshot of the AI ​​code generator in the trigger phase
  5. Once you have finished adding your code, click Continue To test your code step by step. If your code is correct, the step will show that it was successful and display the data.

  6. Now it’s time to add action. Find and select your action app. Connect your account, set the action step, and test the action.

  7. Once you’re done adding your action step(s) to your zip, remember to turn it on.

To use the code as an action, follow these steps:

  1. i Zip editorclick the Trigger step, then find and select your trigger app and trigger event. Connect your account, set up a trigger step, and test the step.

  2. Once you’re done setting up your trigger, click +icon to add a new step.

  3. Search and select Code by Zapier.

  4. Click the Event drop-down menu and select Run JavaScript or Run Python. Then click Continue.

  5. i Input data field, provide a key name and map the data from your trigger step. i Code field, enter your JavaScript or Python code.

    A screenshot of the code in action in the zip editor
  6. If you want to use the AI ​​option, click Create with AI. In the dialog box, enter a prompt that describes the code you want. click Generate the codethen click Use the code.

  7. click Continuethen click Test phase. If your code is correct, the step will show that it was successful and display the data sent.

  8. Once you’re done adding your action step(s) to your zip, remember to check and turn it on.

For more information on setting up code steps in your ZAP, check out our JavaScript or The python Help guides for step-by-step instructions.

do you know You can ask COPILOTZapier’s built-in AI assistant for brainstorming, building, configuring and maintaining cross-product automated systems.

A Zapier couplet prompt that mentions governance and code by Zapier

Use code initiatives to power your business growth

With Code by Zapier, you can customize your workflows to automate complex tasks, integrate seamlessly with any API or custom application, and ultimately solve problems unique to your business.

By adding this extra layer of code, you can transform your data in ways that standard integrations can’t.

Ready to test yourself? Now create a zip with code steps And start powering your business today.

This guide was originally published in May 2022 by Tyler Robertson with previous updates by Elena Alston. It was recently updated in December 2025.