Create a workflow using Python with Functions

Zapier Functions lets you use Python code to build workflows, creating triggers and actions that can directly interact with your code. It also provides an easy way to authenticate your app accounts. Each function can use multiple triggers and actions, and you can create and reuse Python functions and import the most common packages.

Sign up for Functions

To get started with Functions:

  1. Go to https://zapier.com/functions.
  2. Click Try the Beta.
    • If you're on an Enterprise plan, ask the Account Owner or an Admin to opt in to Functions.
  3. Once you've been added to the beta program, you'll receive an email from Zapier’s Functions team. From the email, you can log in to your Zapier account or sign up for one.

Create a new function

Once you have access to Zapier Functions, to create a function:

  1. From the Functions home, click + Create.
  2. In the dialog box, enter a name for your function.
  3. Click Create.

Functions are composed of trigger files and code files. A file named main.py is created for every new function. Once you deploy the function, this file runs and can call on other files. You can start writing your code right away and all changes are automatically saved.

Screen Shot 2025-08-15 at 11.53.21 AM.png

Add triggers

A trigger is an event that starts your workflow. You can add multiple triggers for each function you write.  Once a trigger is set up, you can reference its outputs within the main.py file or any other code files you create. Learn more about setting up function triggers.

The main.py file and other code files

Your code files are where you write Python code, which will include your Zapier actions. When you deploy your function, Zapier will run your main.py file and execute anything included in it whenever the trigger events happen.

You can create several code files to reuse and organize Python functions. Learn how to work with code files.

Use Zapier Copilot to make changes

You can chat with Zapier Copilot at any time to make changes to your functions and debug it. Zapier Copilot can also work with you across all other Zapier products to help you complete any changes in other assets. 

To open Zapier Copilot, click the Copilot icon at the bottom of the left sidebar.

In the chat text field at the bottom left, enter the changes you want to make.

  • Press Enter on your keyboard, or click the Send icon to send a message.
  • (Optional) Click the microphone icon to use voice recognition to dictate your workflow.
  • Click the Stop button in the chat field to stop the AI generation.

Test your code

You can test your code at any time by clicking Run function in the right sidebar. When Zapier runs your code, the trigger sample data you selected will be injected into zapier.trigger_output.

Functions have a 5-minute runtime limit. If execution reaches this limit, the function stops immediately, and any remaining code is not run.

To select a different trigger sample:

  1. In the Test tab, on the right side of the screen, click the Selected Trigger dropdown menu to select a different trigger.
  2. In the Sample data section, click the radio button beside the record number you want to use.

Deploy your function

When you deploy a function, it monitors your trigger apps for trigger events. Once one of them occurs, the function runs the code on main.py

To deploy a function:

  1. Click the Deploy button at the top right. A dialog box will appear.
  2. In the Notes field, enter any information about the function. These notes will be attached to the current version of your function.
  3. Click Deploy.

Functions have a 5-minute runtime limit. If execution reaches this limit, the function stops immediately, and any remaining code is not run.

Note

You cannot deploy a function that contains parsing errors. If there are any, Functions will display a notification when you try to deploy. You must return to the file that contains errors and fix them.

Task usage in Zapier Functions

A task is used in Zapier Functions for each successful zapier.action call made in production. No task is used when testing a function. 

Limitations

Zapier Functions can use up to 1,500 tasks per month.  

Was this article helpful?
0 out of 0 found this helpful