Create a workflow using Python with Functions

Beta

This product is in open beta. It’s available for use but still in active development and may change.

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.
  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.
Note

If you're an Enterprise plan customer, you must contact the Functions team so it can be added to your Zapier account. Only the owner and admins can request access.

 

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.

 

Add triggers

You can add multiple triggers for each function you write. A trigger is an event that starts your workflow. 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.

 

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.

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.
Note

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

 

Versions

Whenever you make changes to your code, Functions creates a new version of the function. You can preview any version and roll back changes by deploying previous versions.

The currently deployed version will be labeled “In production.” If you start a new version but do not deploy it, it will be labeled “Current draft.”

 

Current limitations

During the beta period, Functions has the following limitations:

  • You can have up to 4 functions.
  • You can use up to 1,500 tasks per month. Learn what counts as task usage.

 

Provide feedback and get help

Submit a feature request, provide feedback on existing features, or get help from the Zapier Functions team. You can also discuss Functions with other users on Zapier's Early Access Program Slack.

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