---
title: "Code by Zapier: Add custom code to your workflows"
description: "Need to do something a little more advanced with your workflows? Use Code by Zapier to customize your Zaps to solve advanced business problems."
image: "https://images.ctfassets.net/lzny33ho1g45/62VgFCMZsslmYafnkbMOAa/b47e9241c6a15a57b9f5a731d2b22818/Group_15168.jpg"
---

# Code by Zapier: Add custom code to your workflows

Need to do something a little more advanced with your workflows? Use Code by Zapier to customize your Zaps to solve advanced business problems.

One of the greatest benefits of using Zapier to automate your work is that you don't need to use code. You can build Zaps (our word for automated workflows), [forms](https://zapier.com/interfaces), [agents](https://zapier.com/blog/zapier-agents-guide/), [chatbots](https://zapier.com/ai/chatbot), and [tables](https://zapier.com/tables) without knowing any programming language. 

There may come a time, however, when you need to do something a little more advanced. Perhaps you know exactly what you want to automate, but Zapier's existing actions or triggers can't make it happen. Or maybe you're getting information from App A, but it's not in the right format for App B, and it would take lots of steps to get there otherwise. 

That's where [Code by Zapier](https://zapier.com/apps/code/integrations) comes in. It's a built-in tool specifically for adding the "code" back into "no-code," so you can fully customize your workflows—and even shape AI-generated data, like formatting AI outputs or adding guardrails to keep content consistent. And here's the twist: you don't need to know a lick of code to use code steps. Intrigued? Let's dive in. 

### Jump ahead

- [What is Code by Zapier?](#what)
- [What you can do with Code by Zapier](#use-cases)
- [How to get started with Code by Zapier
](#get-started)

## What is Code by Zapier?

Code by Zapier lets you **add custom code to your Zaps so you can perform specific tasks that go beyond the pre-built triggers and actions** provided by Zapier's existing integrations. 

Code steps act just like any other trigger or action, with one important difference: you tell those steps what to do in_ _[Python](https://help.zapier.com/hc/en-us/articles/8496326417549-Use-Python-code-in-Zaps) or [JavaScript](https://help.zapier.com/hc/en-us/articles/8496310939021-Use-JavaScript-code-in-Zaps). These extra instructions within your Zaps can come in handy when you need to do something more advanced that Zapier might not natively support. You might, for example, use code steps to implement complex [lookup tables](https://help.zapier.com/hc/en-us/articles/8496305146765-Create-lookup-tables-in-Zaps), process [line items](https://zapier.com/blog/formatter-line-item-automation/), clean up raw data like [XML](https://help.zapier.com/hc/en-us/articles/8496197130893-Python-code-examples-in-Zaps#xml-parsing-0-8), or retrieve dynamic dates from your data. 

When used as a trigger, Code by Zapier typically processes input data or checks for specific conditions to decide if the workflow should start. As an action, it allows you to write code that will interact with data coming from the trigger or a previous action step. Actions using code can process information, rearrange data, or retrieve data from an API before sending it on to later steps in your Zap. 

And if you don't know how to write code—or you just get stuck—you can [use AI](https://help.zapier.com/hc/en-us/articles/15666688064013-Generate-a-Code-step-using-AI-Beta) directly within the Zap editor to generate code snippets by simply describing what you'd like to do. 

In essence, code steps allow 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 not supported by standard Zapier integrations.
- **Data manipulation: **Transform, format, or modify data from previous Zap steps to meet specific requirements.
- **Variable support:** Use variables to store and manipulate data within your scripts, making your code more dynamic and adaptable.
- **Built-in Python utilities:** Store and retrieve data between Zap runs with [StoreClient](https://help.zapier.com/hc/en-us/articles/8496293969549-Store-data-from-code-steps-with-StoreClient), send HTTP requests with the [request](https://github.com/kennethreitz/requests/blob/v2.8.1/docs/user/quickstart.rst#make-a-request) utility, and use the print utility to debug your function during execution.
- **Built-in JavaScript utilities: **Store and retrieve data between Zap runs with [StoreClient](https://help.zapier.com/hc/en-us/articles/8496293969549-Store-data-from-code-steps-with-StoreClient), use callback functions to handle tasks that take time to complete, make HTTP requests with the [fetch](https://github.com/node-fetch/node-fetch/tree/32b60634434a63865ea3f79edb33d17e40876c9f#usage) utility, and debug your function with console.log.
- **AI code generator: **Describe how you'd like to customize your trigger or action (in plain English), and AI will write the JavaScript or Python code for you.
- **Testing and debugging:** Run your Zap via the [dashboard](https://zapier.com/app/dashboard) to confirm the behavior you expect and check your [Zap history](https://zapier.com/app/history) for information around your code steps' input data, output details, and logs.

## What you can do with Code by Zapier

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

### Send scheduled HTTP requests to an external API 

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

**What this might look like:**

1. A** **Zap is triggered every hour using** **[Schedule by Zapier](https://zapier.com/blog/schedule-recurring-tasks/).
2. A Code by Zapier step sends a custom HTTP request to an external [API endpoint](https://zapier.com/blog/api-endpoint/) and parses the response.
3. The parsed API response is used to add or update a row to a [Google sheet](https://zapier.com/apps/google-sheets/integrations).

### Parsing and transforming Slack messages with JavaScript

You want to extract and clean up specific data from Slack messages before sending them to another app, without relying on multiple [Formatter](https://zapier.com/blog/zapier-formatter-guide/) steps.

**What this might look like:**

1. A new message is posted to a [Slack](https://zapier.com/apps/slack/integrations) channel.
2. A Code by Zapier step parses the message text, removes user mentions, and extracts the relevant content using [regex](https://zapier.com/blog/what-is-regex).
3. The cleaned message text is sent to [Airtable](https://zapier.com/apps/airtable/integrations) as a structured field in a new record.

### Normalizing timestamps for table storage

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

**What this might look like:**

1. A record is added or updated in [Zapier Tables](https://zapier.com/blog/zapier-tables-guide/).
2. A Code by Zapier step explicitly parses the incoming timestamp and converts it to ISO 8601 in UTC.
3. The normalized timestamp is written back to Zapier Tables by updating the original record.

## How to get started with Code by Zapier

Want to try out a code step?

To use Code as a trigger, follow these steps: 

1. In the [Zap editor](zapier.com/editor), click the trigger step, then search for and select **Code by Zapier**.
2. Click the event dropdown menu and select **Run Javascript** or **Run Python**,** **then click **Continue. 
**

3. In the _Configure_ tab, use the _Code_ field to enter your JavaScript or Python code.

4. If you'd like AI to write code for you, click **Generate with AI**. In the dialog box, enter a prompt that describes your desired code. Click **Generate code**, then click **Use code**.

5. Once you've finished adding your code, click **Continue** to test your code step. If your code is valid, the step will show it was successful and display the data.
6. Now it's time to add an action. Search for and select your action app. Connect your account, set up the action step, and test the action.
7. Once you've finished adding your action step(s) to your Zap, remember to turn it on.

To use Code as an action, follow these steps:

1. In the [Zap editor](zapier.com/editor), click the trigger step, then search for and select your trigger app and the trigger event. Connect your account, set up the trigger step, and test the step.
2. Once you've finished setting up your trigger, click the **+**icon to add a new step.
3. Search for and select **Code by Zapier**.
4. Click the event dropdown menu and select **Run Javascript **or** Run Python**. Then click **Continue**.
5. In the _Input Data _field, provide a key name and map the data from your trigger step. In the _Code_ field, enter your JavaScript or Python code.

6. If you'd like to use the AI option, click **Generate with AI**. In the dialog box, enter a prompt that describes your desired code. Click **Generate code**, then click **Use code**.
7. Click **Continue**, then click **Test step**. If your code is valid, the step will show it was successful and display the data sent.
8. Once you've finished adding your action step(s) to your Zap, remember to test and turn it on.

For more information on setting up code steps in your Zap, check out our [JavaScript](https://help.zapier.com/hc/en-us/articles/8496310939021-Use-JavaScript-code-in-Zaps#1-add-a-code-trigger-0-0) or [Python](https://help.zapier.com/hc/en-us/articles/8496326417549-Use-Python-code-in-Zaps#h_01H9FNT4XPDRQFC2DMYG8J7T4E) help guides for step-by-step instructions.

## Use code steps to power your business's growth

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

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

**Ready to try it out yourself? **[**Build a Zap with code steps now**](https://zapier.com/editor)** and start powering your business today. **

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