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:
- Go to https://zapier.com/functions.
- Click Try the Beta.
- If you're on an Enterprise plan, ask the Account Owner or an Admin to opt in to Functions.
- 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:
- From the Functions home, click + Create.
- In the dialog box, enter a name for your function.
- 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
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 Copilot to make changes
You can chat with Copilot at any time to make changes to your functions and debug it. Copilot can also work with you across all other Zapier products to help you complete any changes in other assets.
To open 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:
- In the Test tab, on the right side of the screen, click the Selected Trigger dropdown menu to select a different trigger.
- 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:
- Click the Deploy button at the top right. A dialog box will appear.
- In the Notes field, enter any information about the function. These notes will be attached to the current version of your function.
- 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.
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. Learn more about what counts as task usage in Zapier products.
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.
0 comments
Article is closed for comments.