Article
zapier-aiautomationno-codeai-actionsllm-toolsworkflow-automationapi-integrationpython
Build AI Workflows with Natural Language using Zapier AI
Zapier AI lets you create automations by describing them in plain English. This guide shows you how to build a multi-step 'Zap' using the AI assistant and then trigger it from an LLM using the AI Actions API.
beginner30 min5 steps
The play
- Create a Zap with the AI AssistantLog into your Zapier account. On the dashboard, use the 'What do you want to automate?' bar to describe your workflow in plain English. For example: 'When I get a new email in Gmail with an invoice, save the attachment to Google Drive and send me a Slack message'.
- Refine and Configure the AI-Generated ZapZapier AI will suggest a trigger and a series of actions. Review each step. Click on a step to connect your accounts (e.g., Gmail, Google Drive, Slack) and map the data fields. Ensure the 'File Attachment' from the Gmail step is correctly mapped to the 'File' field in the Google Drive step.
- Enable Your Zap as an AI ActionOnce your Zap is configured and tested, click 'Publish'. Then, navigate to the 'AI Actions' section in your Zapier account settings. Find the Zap you just created and click to enable it as an AI Action. This exposes it via a secure API for external AI models to use.
- Get Your Action ID and API KeyIn the AI Actions settings page, find the action you just enabled. Copy its 'Action ID'. Next, go to the 'Credentials' tab within AI Actions to find and copy your API Key. Keep these secure.
- Trigger the Action via APIWith your Action ID and API Key, you can trigger your Zap from any application that can make an HTTP request. Use a script to send a natural language instruction to the Zapier AI Actions API, which will execute your workflow.
Starter code
import os
import requests
# Get your Action ID from the AI Actions page in Zapier (e.g., "01H8X...")
# Best practice: use environment variables
ACTION_ID = os.environ.get("ZAPIER_ACTION_ID", "REPLACE_WITH_YOUR_ACTION_ID")
# Get your API Key from your AI Actions settings (e.g., "a1b2c3d4-...")
API_KEY = os.environ.get("ZAPIER_NLA_API_KEY", "REPLACE_WITH_YOUR_API_KEY")
# The instruction for the AI to execute the action
INSTRUCTIONS = "Find the latest email from 'billing@example.com' and save its attachment to my 'Invoices' folder in Google Drive, then send me a Slack message about it."
if "REPLACE_WITH" in ACTION_ID or "REPLACE_WITH" in API_KEY:
print("Please replace the placeholder values for ACTION_ID and API_KEY.")
exit()
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
json_data = {
"instructions": INSTRUCTIONS,
}
# The API endpoint includes your specific Action ID
url = f"https://actions.zapier.com/api/v1/exposed/{ACTION_ID}/execute/"
print(f"Sending instruction: '{INSTRUCTIONS}' to Action ID: {ACTION_ID}")
response = requests.post(url, headers=headers, json=json_data)
print(f"\nStatus Code: {response.status_code}")
print("Response JSON:")
# The response contains the result and a link to view the run log in Zapier.
print(response.json())