Skill: ivangdavila/zapier (version 1.0.0)

--- name: Zapier slug: zapier version: 1.0.0 homepage: https://clawic.com/skills/zapier description: Complete Zapier automation with Zaps, Tables, Interfaces, webhooks, REST Hooks API, and 6000+ app integrations. metadata: {"clawdbot":{"emoji":"⚡","requires":{"env":["ZAPIER_API_KEY","ZAPIER_TABLES_TOKEN"],"config":["~/zapier/"]},"primaryEnv":"ZAPIER_API_KEY","os":["linux","darwin","win32"]}} --- # Zapier Complete Zapier reference. See auxiliary files for detailed operations. ## Quick Start ```bash # Test API connection curl -H "Authorization: Bearer $ZAPIER_API_KEY" \ https://api.zapier.com/v1/profile ``` ## Setup On first use, read `setup.md`. Preferences stored in `~/zapier/memory.md`. ## When to Use Any Zapier operation: create Zaps, manage Tables, build Interfaces, configure webhooks, integrate 6000+ apps, automate workflows. ## Architecture ``` ~/zapier/ ├── memory.md # Account context, common Zaps └── zaps/ # Documented configurations ``` ## Quick Reference | Topic | File | |-------|------| | Setup & memory | `setup.md`, `memory-template.md` | | REST Hooks API | `api.md` | | Triggers (all types) | `triggers.md` | | Actions (all types) | `actions.md` | | Filters, Paths, Formatters | `logic.md` | | Webhooks (Catch Hook, send) | `webhooks.md` | | Zapier Tables (database) | `tables.md` | | Zapier Interfaces (forms) | `interfaces.md` | | Popular integrations | `integrations.md` | | Patterns & recipes | `patterns.md` | ## Core Rules 1. **Test mode first** — Use test data before enabling Zap 2. **Triggers define scope** — Zap only runs when trigger fires 3. **Field mapping explicit** — Always verify data flows correctly 4. **Filters before actions** — Reduce unnecessary task usage 5. **Idempotency via dedup** — Use Dedup filter for critical flows 6. **Webhooks for instant** — Polling triggers have 1-15 min delay ## Authentication **Environment variables:** - `ZAPIER_API_KEY` — API key from zapier.com/developer/platform - `ZAPIER_TABLES_TOKEN` — Tables API token (optional, for Tables API) ```bash curl -H "Authorization: Bearer $ZAPIER_API_KEY" \ https://api.zapier.com/v1/zaps ``` ## Zapier Product Suite | Product | Purpose | File | |---------|---------|------| | **Zaps** | Automated workflows | `triggers.md`, `actions.md` | | **Tables** | No-code database | `tables.md` | | **Interfaces** | Forms, pages, chatbots | `interfaces.md` | | **Chatbots** | AI-powered assistants | `interfaces.md` | | **Canvas** | Visual workflow planning | Web UI only | ## Common Traps - **Amount in wrong format** → Zapier passes strings, convert with Formatter - **No idempotency** → Dedup action prevents duplicate processing - **Webhook timeout** → Return 200 within 30 seconds - **Task burn** → One Zap run = 1+ tasks, filters don't count - **Polling delay** → Free: 15min, Paid: 1-2min, Webhooks: instant ## External Endpoints | Endpoint | Purpose | |----------|---------| | `https://api.zapier.com/v1/*` | REST Hooks API | | `https://hooks.zapier.com/hooks/catch/*` | Incoming webhooks | | `https://tables.zapier.com/api/v1/*` | Tables API | | Connected apps | 6000+ via Zapier | ## Security & Privacy **Environment variables used:** - `ZAPIER_API_KEY` — for REST Hooks API authentication **Sent to Zapier:** Workflow data, field mappings, trigger/action configs **Sent to connected apps:** Only data you explicitly map **Stays local:** ~/zapier/ preferences, API keys (never logged) **Never:** Expose API keys, skip webhook verification ## Trust This skill sends data to Zapier (zapier.com) and any apps you connect through Zaps. ## Related Skills Install with `clawhub install <slug>` if user confirms: - `api` — REST API patterns - `webhook` — Webhook fundamentals - `saas` — SaaS metrics and billing ## Feedback - If useful: `clawhub star zapier` - Stay updated: `clawhub sync`

path: actions.md
content: # Actions — Zapier

## Action Types

| Type | Purpose | Example |
|------|---------|---------|
| **Create** | Add new record | Create row, Create contact |
| **Update** | Modify existing | Update row, Update deal |
| **Find** | Search records | Find customer, Lookup row |
| **Find or Create** | Search, create if missing | Get or create contact |
| **Delete** | Remove record | Delete row |
| **Custom** | App-specific | Send email, Post message |

## Create Actions

### Create Google Sheets Row
```
Action: Create Spreadsheet Row
Spreadsheet: [Your Sheet]
Worksheet: [Sheet1]
Name: {{trigger.name}}
Email: {{trigger.email}}
Date: {{trigger.created_at}}
```

### Create Airtable Record
```
Action: Create Record
Base: [Your Base]
Table: [Contacts]
Name: {{trigger.name}}
Email: {{trigger.email}}
Status: New
```

### Create Salesforce Lead
```
Action: Create Lead
First Name: {{trigger.first_name}}
Last Name: {{trigger.last_name}}
Email: {{trigger.email}}
Company: {{trigger.company}}
Lead Source: Website
```

### Create Notion Database Item
```
Action: Create Database Item
Database: [Your Database]
Name: {{trigger.title}}
Status: To Do
Date: {{trigger.date}}
```

## Update Actions

### Update Google Sheets Row
```
Action: Update Spreadsheet Row
Spreadsheet: [Your Sheet]
Worksheet: [Sheet1]
Row: {{previous_step.row_number}}
Status: Processed
Processed Date: {{zap_meta_human_now}}
```

### Update Airtable Record
```
Action: Update Record
Base: [Your Base]
Table: [Contacts]
Record: {{find_step.id}}
Status: Active
Last Contact: {{zap_meta_human_now}}
```

### Update Salesforce Record
```
Action: Update Record
Object Type: Lead
Record: {{find_step.id}}
Status: Qualified
```

## Find Actions

### Find Google Sheets Row
```
Action: Lookup Spreadsheet Row
Spreadsheet: [Your Sheet]
Worksheet: [Sheet1]
Lookup Column: Email
Lookup Value: {{trigger.email}}
```

### Find Airtable Record
```
Action: Find Record
Base: [Your Base]
Table: [Contacts]
Field: Email
Search Value: {{trigger.email}}
```

### Find Salesforce Record
```
Action: Find Record
Object Type: Contact
Field to Search: Email
Search Value: {{trigger.email}}
```

## Find or Create Pattern

**Most reliable for syncing systems.** Searches first, creates only if not found.

### Airtable — Find or Create
```
Action: Find or Create Record
Base: [Your Base]
Table: [Contacts]
Search Field: Email
Search Value: {{trigger.email}}
-- If not found, create with: --
Name: {{trigger.name}}
Email: {{trigger.email}}
Source: Zapier
```

### HubSpot — Find or Create Contact
```
Action: Find or Create Contact
Search Property: email
Search Value: {{trigger.email}}
-- If not found, create with: --
Email: {{trigger.email}}
First Name: {{trigger.first_name}}
Last Name: {{trigger.last_name}}
```

## Communication Actions

### Send Email (Gmail)
```
Action: Send Email
To: {{trigger.email}}
From Name: Your Company
Subject: Welcome to {{company_name}}
Body: Hi {{trigger.name}},

Thank you for signing up!

Best,
Team
```

### Send Slack Message
```
Action: Send Channel Message
Channel: #notifications
Message: New signup: {{trigger.name}} ({{trigger.email}})
```

### Send Slack Direct Message
```
Action: Send Direct Message
User: @john
Message: New lead assigned to you: {{trigger.name}}
```

### Send SMS (Twilio)
```
Action: Send SMS
To: {{trigger.phone}}
From: +1234567890
Body: Your order {{trigger.order_id}} has shipped!
```

## Webhook Action

Send data to any URL.

### POST JSON
```
Action: Webhooks by Zapier → POST
URL: https://api.yourapp.com/webhook
Payload Type: JSON
Data:
  name: {{trigger.name}}
  email: {{trigger.email}}
  event: new_signup
```

### POST with Headers
```
Action: Webhooks by Zapier → POST
URL: https://api.yourapp.com/webhook
Headers:
  [REDACTED_SECRET]
  Content-Type: application/json
Data:
  user_id: {{trigger.id}}
```

### Custom Request
```
Action: Webhooks by Zapier → Custom Request
Method: PATCH
URL: https://api.yourapp.com/users/{{trigger.user_id}}
Headers:
  [REDACTED_SECRET]
Data:
  status: active
```

## Code Actions (JavaScript/Python)

### JavaScript
```javascript
// Input: inputData.email, inputData.name
const email = inputData.email.toLowerCase().trim();
const domain = email.split('@')[1];
const isBusinessEmail = !['gmail.com', 'yahoo.com', 'hotmail.com'].includes(domain);

output = [{
  email: email,
  domain: domain,
  isBusinessEmail: isBusinessEmail,
  nameParts: inputData.name.split(' ')
}];
```

### Python
```python
# Input: input_data['email'], input_data['name']
email = input_data['email'].lower().strip()
domain = email.split('@')[1]
personal_domains = ['gmail.com', 'yahoo.com', 'hotmail.com']
is_business = domain not in personal_domains

output = [{
    'email': email,
    'domain': domain,
    'is_business_email': is_business,
    'first_name': input_data['name'].split()[0]
}]
```

## Delay Actions

### Delay For
```
Action: Delay by Zapier
Delay For: 1 hour
```

Options: minutes, hours, days

### Delay Until
```
Action: Delay by Zapier
Delay Until: {{trigger.event_date}}
Time: 9:00 AM
Timezone: America/New_York
```

### Delay for Business Hours
```
Action: Delay by Zapier
Resume at: Next weekday at 9:00 AM
```

## Looping

Process multiple items from a single trigger.

### Line Items
When trigger returns array (e.g., order items):
```
Action: Looping by Zapier
Values to Loop: {{trigger.line_items}}
-- For each item: --
Create Google Sheets Row:
  Product: {{loop.product_name}}
  Quantity: {{loop.quantity}}
  Price: {{loop.price}}
```

## Error Handling

### Continue on Error
```
Action Settings:
☑️ Continue Zap even if this action fails
```

### Paths for Error Handling
```
Path A: Success
  Condition: {{previous_step.id}} exists
  Action: Send success notification

Path B: Failure  
  Condition: {{previous_step.id}} doesn't exist
  Action: Send error alert
```

## Action Best Practices

1. **Test each action** — Verify data flows correctly
2. **Use Find or Create** — Prevents duplicates
3. **Add delays wisely** — Don't spam external APIs
4. **Handle errors** — Add paths for failure cases
5. **Check task usage** — Each action = 1 task minimum


path: api.md
content: # REST Hooks API — Zapier

## Authentication

Get API key from: https://zapier.com/developer/platform

```bash
export ZAPIER_API_KEY="your_api_key_here"

# Test connection
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  https://api.zapier.com/v1/profile
```

## Profile & Account

### Get Profile
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  https://api.zapier.com/v1/profile
```

Response:
```json
{
  "id": 123456,
  "email": "[REDACTED_SECRET]",
  "first_name": "John",
  "last_name": "Doe",
  "timezone": "America/New_York"
}
```

## Zaps Management

### List All Zaps
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/zaps"
```

### Get Zap Details
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/zaps/ZAP_ID"
```

### Get Zap Runs (History)
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/zaps/ZAP_ID/runs?limit=10"
```

### Turn Zap On
```bash
curl -X PUT \
  -H "Authorization: Bearer $ZAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"is_enabled": true}' \
  "https://api.zapier.com/v1/zaps/ZAP_ID"
```

### Turn Zap Off
```bash
curl -X PUT \
  -H "Authorization: Bearer $ZAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"is_enabled": false}' \
  "https://api.zapier.com/v1/zaps/ZAP_ID"
```

## Apps & Authentication

### List Connected Apps
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/apps"
```

### Get App Details
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/apps/APP_SLUG"
```

### List App Authentications
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/authentications"
```

## AI Actions (for LLM Integration)

Zapier provides AI Actions for LLM integrations (ChatGPT, Claude, etc.).

### Get Available Actions
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://actions.zapier.com/api/v1/exposed/"
```

### Execute AI Action
```bash
curl -X POST \
  -H "Authorization: Bearer $ZAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instructions": "Send a Slack message to #general saying Hello"
  }' \
  "https://actions.zapier.com/api/v1/run/ACTION_ID/"
```

### List AI Action Logs
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://actions.zapier.com/api/v1/logs/"
```

## Natural Language Actions (NLA)

For AI assistants to control Zapier with natural language.

### Available via OpenAI Plugin
- Configure at: https://actions.zapier.com/gpt/
- Exposes your Zaps as natural language actions

### Direct NLA Endpoint
```bash
curl -X POST \
  -H "Authorization: Bearer $ZAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instructions": "Create a Google Calendar event tomorrow at 3pm called Team Standup"
  }' \
  "https://nla.zapier.com/api/v1/run/"
```

## Rate Limits

| Plan | Requests/min | Requests/day |
|------|--------------|--------------|
| Free | 10 | 1,000 |
| Starter | 20 | 5,000 |
| Professional | 50 | 25,000 |
| Team | 100 | 100,000 |

## Error Handling

### Common Error Codes

| Code | Meaning | Solution |
|------|---------|----------|
| 401 | Invalid API key | Check ZAPIER_API_KEY |
| 403 | Permission denied | Check app permissions |
| 404 | Resource not found | Verify Zap/resource ID |
| 429 | Rate limited | Wait and retry |
| 500 | Server error | Retry with backoff |

### Error Response Format
```json
{
  "errors": [
    {
      "code": "INVALID_REQUEST",
      "message": "The request was invalid",
      "field": "trigger_id"
    }
  ]
}
```

## Pagination

All list endpoints support pagination:

```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/zaps?offset=0&limit=20"
```

Parameters:
- `offset`: Starting position (default 0)
- `limit`: Number of results (default 20, max 100)

## Webhooks API

### Subscribe to Zap Events
```bash
curl -X POST \
  -H "Authorization: Bearer $ZAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "target_url": "https://your-server.com/webhooks/zapier",
    "event": "zap.run.completed"
  }' \
  "https://api.zapier.com/v1/hooks"
```

### Webhook Events

| Event | Description |
|-------|-------------|
| `zap.run.completed` | Zap finished running |
| `zap.run.errored` | Zap encountered error |
| `zap.turned_off` | Zap was disabled |
| `zap.turned_on` | Zap was enabled |

### List Active Hooks
```bash
curl -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/hooks"
```

### Delete Hook
```bash
curl -X DELETE \
  -H "Authorization: Bearer $ZAPIER_API_KEY" \
  "https://api.zapier.com/v1/hooks/HOOK_ID"
```


path: integrations.md
content: # Popular Integrations — Zapier

## Google Workspace

### Google Sheets

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Spreadsheet Row | Process new entries |
| New or Updated Row | Sync changes |
| New Spreadsheet | Monitor file creation |

**Actions:**
| Action | Use Case |
|--------|----------|
| Create Spreadsheet Row | Log data |
| Update Spreadsheet Row | Modify existing |
| Lookup Spreadsheet Row | Find by value |
| Create Spreadsheet | Generate reports |

**Common Pattern: Form to Sheet**
```
Typeform → Create Row in Google Sheets
  Name: {{trigger.name}}
  Email: {{trigger.email}}
  Submitted: {{zap_meta_human_now}}
```

### Gmail

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Email | Process incoming |
| New Labeled Email | Filtered processing |
| New Attachment | File handling |

**Actions:**
| Action | Use Case |
|--------|----------|
| Send Email | Notifications |
| Create Draft | Review before send |
| Add Label | Organization |

**Common Pattern: Lead Notification**
```
New Salesforce Lead
→ Send Gmail:
  To: [REDACTED_SECRET]
  Subject: New Lead: {{trigger.name}}
  Body: Company: {{trigger.company}}
        Email: {{trigger.email}}
```

### Google Calendar

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Event | Track meetings |
| Event Start | Reminders |
| Updated Event | Sync changes |

**Actions:**
| Action | Use Case |
|--------|----------|
| Create Event | Schedule meetings |
| Quick Add Event | Natural language |
| Find Event | Lookup existing |
| Update Event | Modify details |

### Google Drive

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New File in Folder | Process uploads |
| New File (any) | Global monitoring |
| Updated File | Track changes |

**Actions:**
| Action | Use Case |
|--------|----------|
| Upload File | Store documents |
| Copy File | Duplicate templates |
| Create Folder | Organization |
| Move File | Workflow routing |

## Slack

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Message (Channel) ⚡ | Monitor discussions |
| New Message (DM) ⚡ | Personal alerts |
| New Reaction ⚡ | Approval workflows |
| New User | Onboarding |

**Actions:**
| Action | Use Case |
|--------|----------|
| Send Channel Message | Notifications |
| Send Direct Message | Personal alerts |
| Create Channel | Project channels |
| Set Status | Availability |
| Add Reaction | Confirmations |

**Common Pattern: Error Alert**
```
Catch Hook (error webhook)
→ Send Slack Message:
  Channel: #alerts
  Text: 🚨 Error: {{trigger.error_message}}
        Service: {{trigger.service}}
        Time: {{zap_meta_human_now}}
```

**Slack Blocks (Rich Messages):**
```json
{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*New Lead* 🎉\n*Name:* {{trigger.name}}\n*Company:* {{trigger.company}}"
      }
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "button",
          "text": {"type": "plain_text", "text": "View in CRM"},
          "url": "https://crm.example.com/leads/{{trigger.id}}"
        }
      ]
    }
  ]
}
```

## Salesforce

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Lead | Sales pipeline |
| New Contact | Customer management |
| New Opportunity | Deal tracking |
| Updated Record | Sync changes |

**Actions:**
| Action | Use Case |
|--------|----------|
| Create Lead | Inbound leads |
| Create Contact | Customer records |
| Create Opportunity | Deal creation |
| Update Record | Status changes |
| Find Record | Lookups |
| Add to Campaign | Marketing |

**Common Pattern: Web-to-Lead**
```
Typeform Submission
→ Find or Create Salesforce Contact (by email)
→ Create Salesforce Lead:
  First Name: {{trigger.first_name}}
  Last Name: {{trigger.last_name}}
  Email: {{trigger.email}}
  Company: {{trigger.company}}
  Lead Source: Website
```

## HubSpot

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Contact | CRM sync |
| New Deal | Pipeline |
| Form Submission | Lead capture |
| New Company | Account management |

**Actions:**
| Action | Use Case |
|--------|----------|
| Create/Update Contact | Sync contacts |
| Create Deal | Sales pipeline |
| Create Company | Account records |
| Create Engagement | Log activities |
| Add to List | Segmentation |

## Notion

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Database Item | Track additions |
| Updated Database Item | Sync changes |

**Actions:**
| Action | Use Case |
|--------|----------|
| Create Database Item | Add records |
| Update Database Item | Modify records |
| Append to Page | Add content |
| Create Page | New documents |

**Common Pattern: Task Management**
```
New Slack Message in #requests
→ Create Notion Database Item:
  Database: Tasks
  Name: {{trigger.text}}
  Status: To Do
  Requested By: {{trigger.user.name}}
```

## Airtable

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Record | Process additions |
| New or Updated Record | Sync all changes |
| New Record in View | Filtered processing |

**Actions:**
| Action | Use Case |
|--------|----------|
| Create Record | Add data |
| Update Record | Modify data |
| Find Record | Lookups |
| Find or Create | Dedupe sync |
| Delete Record | Cleanup |

## Stripe

**Triggers (all instant ⚡):**
| Trigger | Use Case |
|---------|----------|
| New Payment | Revenue tracking |
| New Customer | User sync |
| New Subscription | SaaS metrics |
| Canceled Subscription | Churn handling |
| Failed Payment | Dunning |

**Actions:**
| Action | Use Case |
|--------|----------|
| Create Customer | Setup billing |
| Create Charge | One-time payment |
| Create Invoice | Billing |

## Mailchimp / Email Marketing

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Subscriber | Welcome flow |
| Unsubscribed | Churn tracking |
| Campaign Sent | Tracking |

**Actions:**
| Action | Use Case |
|--------|----------|
| Add Subscriber | List building |
| Update Subscriber | Profile sync |
| Add/Remove Tags | Segmentation |
| Send Campaign | Newsletters |

## Trello / Asana / Monday.com

**Common Triggers:**
- New Card/Task
- Card/Task Moved
- Due Date Approaching

**Common Actions:**
- Create Card/Task
- Update Card/Task
- Move Card/Task
- Add Comment

**Common Pattern: Issue to Task**
```
New GitHub Issue
→ Create Trello Card:
  Board: Development
  List: Backlog
  Name: {{trigger.title}}
  Description: {{trigger.body}}
  Due Date: +7 days
```

## Twilio (SMS)

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New SMS ⚡ | Two-way messaging |
| New Call ⚡ | Call tracking |

**Actions:**
| Action | Use Case |
|--------|----------|
| Send SMS | Notifications |
| Make Call | Phone alerts |

**Common Pattern: Order Shipped**
```
Shopify Order Fulfilled
→ Send Twilio SMS:
  To: {{trigger.customer.phone}}
  Body: Your order {{trigger.order_number}} has shipped! 
        Track: {{trigger.tracking_url}}
```

## GitHub

**Triggers:**
| Trigger | Use Case |
|---------|----------|
| New Issue ⚡ | Bug tracking |
| New Pull Request ⚡ | Code review |
| New Commit ⚡ | CI/CD |
| New Release | Announcements |

**Actions:**
| Action | Use Case |
|--------|----------|
| Create Issue | Ticket creation |
| Create Comment | Responses |
| Update Issue | Status changes |

## Multi-App Patterns

### Lead → CRM → Notification
```
Typeform (New Entry)
→ Find or Create Salesforce Contact
→ Create Salesforce Lead
→ Send Slack Message to #sales
→ Create Google Calendar Event (follow-up)
```

### Payment → Delivery → Communication
```
Stripe (New Payment)
→ Update Airtable Order Status
→ Send Gmail Order Confirmation
→ Send Twilio SMS with ETA
→ Create Trello Card for Fulfillment
```

### Content → Distribution
```
WordPress (New Post)
→ Create Twitter Thread
→ Post to LinkedIn
→ Send to Mailchimp Campaign
→ Create Buffer Queue Item
```


path: interfaces.md
content: # Zapier Interfaces — Forms, Pages & Chatbots

## Overview

Zapier Interfaces lets you create custom apps without code.

| Component | Purpose |
|-----------|---------|
| **Forms** | Collect data from users |
| **Pages** | Display data (dashboards, portals) |
| **Chatbots** | AI-powered conversation interfaces |
| **Kanban** | Visual task management |
| **Tables** | Data grids with editing |

## Forms

### Create Form

1. Go to interfaces.zapier.com
2. New Interface → Form
3. Add fields
4. Configure submissions

### Field Types

| Type | Use Case |
|------|----------|
| Short Text | Name, Title |
| Long Text | Description, Feedback |
| Email | Contact email |
| Number | Quantity, Amount |
| Dropdown | Select from options |
| Multiple Choice | Radio buttons |
| Checkboxes | Multi-select |
| Date | Event dates |
| Time | Appointment times |
| File Upload | Documents, images |
| Hidden | Pre-filled values |

### Form Settings

**Submission Behavior:**
```
On Submit:
  ☑️ Show success message
  ☑️ Redirect to URL
  ☑️ Allow another submission
```

**Pre-fill Values:**
```
URL: https://yourform.zapier.app?name=John&email=[REDACTED_SECRET]
```

Fields auto-populate from URL parameters.

### Form to Zap

```
Trigger: New Submission in Zapier Interfaces
Interface: [Your Form]
↓
→ Create Record in Zapier Tables
→ Send Email Confirmation
→ Add to CRM
```

### Conditional Logic

Show/hide fields based on answers:
```
If "Plan" = "Enterprise"
  Show: "Company Size" field
  Show: "Budget" field
```

### File Uploads

```
Field: Resume Upload
Allowed Types: PDF, DOC, DOCX
Max Size: 10MB
```

Access in Zap: `{{trigger.Resume Upload.url}}`

## Pages

### Create Page

1. New Interface → Page
2. Add components
3. Connect data sources
4. Publish

### Page Components

| Component | Purpose |
|-----------|---------|
| **Text** | Headlines, descriptions |
| **Table** | Data grid from Tables |
| **Chart** | Bar, line, pie charts |
| **Kanban** | Task board |
| **Form** | Embedded form |
| **Button** | Trigger actions |
| **Image** | Logos, graphics |
| **Embed** | External content |

### Connect to Tables

```
Table Component:
  Source: Zapier Tables → Orders
  Columns: Order ID, Customer, Total, Status
  Filter: Status = "Pending"
  Sort: Created At (descending)
```

### Charts

```
Chart Component:
  Type: Bar Chart
  Source: Zapier Tables → Sales
  X-Axis: Month
  Y-Axis: Revenue (Sum)
```

### Dynamic Content

Use variables from Tables:
```
Text: "Total Orders: {{tables.orders.count}}"
Text: "Revenue: ${{tables.sales.total_sum}}"
```

### Page Actions

Buttons can trigger Zaps:
```
Button: "Approve All"
→ Trigger: Button Clicked
→ Update Records where Status = "Pending"
→ Set Status = "Approved"
```

## Chatbots

### Create Chatbot

1. New Interface → Chatbot
2. Configure AI settings
3. Define knowledge base
4. Set up actions

### AI Configuration

```
System Prompt:
"You are a helpful customer support agent for Acme Corp.
You can help with:
- Order status inquiries
- Return requests
- Product questions

Always be friendly and professional."
```

### Knowledge Base

Connect data sources the AI can reference:
- Zapier Tables
- Google Docs
- Notion pages
- PDF uploads

### Chatbot Actions

Let the bot trigger Zaps:
```
Action: "Create Support Ticket"
When user says: needs help, has issue, problem with
→ Trigger Zap: Create record in Support Table
→ Send notification to support team
```

### Variables in Chatbot

Pre-fill context:
```
URL: https://yourchatbot.zapier.app?customer_id=12345&name=John
```

Bot can access: `{{customer_id}}`, `{{name}}`

### Handoff to Human

```
If bot confidence < 70%:
  "Let me connect you with a human agent."
  → Trigger Zap: Create urgent ticket
  → Notify support channel
```

## Kanban Boards

### Setup

```
Kanban Component:
  Source: Zapier Tables → Tasks
  Group By: Status (To Do, In Progress, Done)
  Card Title: Task Name
  Card Details: Assignee, Due Date
```

### Drag-and-Drop

When card moves between columns:
- Record updates automatically
- Can trigger Zap on status change

### Example: Project Board

```
Columns:
  - Backlog
  - To Do
  - In Progress
  - Review
  - Done

Card Fields:
  - Title
  - Assignee
  - Priority (color coded)
  - Due Date
  - Tags
```

## Authentication

### Public Access
```
Sharing: Anyone with link
```

### Password Protection
```
Sharing: Password required
[REDACTED_SECRET]
```

### Zapier Login
```
Sharing: Zapier account required
Allowed Users: specific emails or domains
```

### Custom Auth (via Zap)
```
Interface loads → Check auth cookie
If missing → Redirect to login form
Login form → Validate credentials via Zap
Success → Set cookie, redirect to interface
```

## Embedding

### Embed in Website

```html
<iframe 
  src="https://yourform.zapier.app" 
  width="100%" 
  height="600"
  frameborder="0">
</iframe>
```

### Embed in Notion

```
/embed → paste Interface URL
```

### Custom Domain

1. Interfaces → Settings → Custom Domain
2. Add CNAME record: `forms.yourcompany.com` → `zapier.app`
3. Verify and enable

## Styling

### Branding

```
Settings:
  Logo: Upload company logo
  Primary Color: #3B82F6
  Background: #FFFFFF
  Font: Inter
```

### Custom CSS (Advanced)

```css
/* Custom button style */
.zap-button-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
}
```

## Common Patterns

### Lead Capture Form

```
Form Fields:
  - Name (required)
  - Email (required)
  - Company
  - Phone
  - "How did you hear about us?" (dropdown)

On Submit:
  → Create CRM contact
  → Send welcome email
  → Notify sales team
```

### Customer Portal

```
Page Components:
  - Header with logo
  - "Your Orders" table (filtered by logged-in user)
  - "Submit Request" form
  - "Chat with Support" chatbot
```

### Internal Dashboard

```
Page Components:
  - KPI cards (Revenue, Users, Churn)
  - Revenue chart (monthly)
  - Recent orders table
  - Task kanban board
  - "Quick Actions" buttons
```

## Best Practices

1. **Mobile-first** — Test on mobile devices
2. **Progressive disclosure** — Don't overwhelm with fields
3. **Validation messages** — Clear error feedback
4. **Loading states** — Show progress for slow operations
5. **Success confirmation** — Confirm submissions clearly


path: logic.md
content: # Filters, Paths & Formatters — Zapier

## Filters

Filters stop the Zap if conditions aren't met. **Filters don't count as tasks.**

### Basic Filter Syntax

```
Only continue if...
[Field] [Condition] [Value]
```

### Text Conditions

| Condition | Example |
|-----------|---------|
| (Text) Contains | Email contains "@company.com" |
| (Text) Does not contain | Email does not contain "@test.com" |
| (Text) Exactly matches | Status exactly matches "approved" |
| (Text) Does not exactly match | Status does not match "spam" |
| (Text) Is in | Country is in "US, CA, UK" |
| (Text) Starts with | Name starts with "VIP" |
| (Text) Ends with | Email ends with ".edu" |
| (Text) Matches pattern | Phone matches "+1[0-9]{10}" |

### Number Conditions

| Condition | Example |
|-----------|---------|
| (Number) Greater than | Amount greater than 100 |
| (Number) Less than | Quantity less than 0 |
| (Number) Equals | Status code equals 200 |

### Boolean Conditions

| Condition | Example |
|-----------|---------|
| (Boolean) Is true | Is premium is true |
| (Boolean) Is false | Unsubscribed is false |

### Existence Conditions

| Condition | Example |
|-----------|---------|
| Exists | Email exists |
| Does not exist | Phone does not exist |

### Date Conditions

| Condition | Example |
|-----------|---------|
| (Date/Time) After | Created after 2024-01-01 |
| (Date/Time) Before | Expires before today |

### Multiple Conditions (AND)

All conditions must be true:
```
Only continue if...
☑️ AND
  Status exactly matches "paid"
  Amount greater than 50
  Country is in "US, CA"
```

### Multiple Conditions (OR)

Any condition can be true:
```
Only continue if...
☑️ OR
  Email ends with "@company.com"
  Is VIP is true
  Amount greater than 1000
```

### Combining AND/OR

```
Only continue if...
☑️ AND
  Status exactly matches "paid"
  ☑️ OR
    Country is in "US, CA"
    Is VIP is true
```

## Paths

Paths create conditional branches. Each path runs its own set of actions.

### Basic Path Structure

```
Trigger
↓
Path A: High Value
  Condition: Amount > 1000
  → Send to Sales Team
  → Create VIP Flag

Path B: Standard
  Condition: Amount <= 1000
  → Add to Newsletter
  → Send Welcome Email

Path C: (Fallback)
  Condition: Always run
  → Log to Spreadsheet
```

### Path Conditions

Same conditions as filters. Each path needs its condition.

### Path Examples

**Route by Country:**
```
Path A: US/Canada
  Condition: Country is in "US, CA"
  → Assign to NA Sales Team

Path B: Europe
  Condition: Country is in "UK, DE, FR, ES, IT"
  → Assign to EU Sales Team

Path C: Other
  → Assign to Global Team
```

**Route by Amount:**
```
Path A: Enterprise
  Condition: Amount greater than 10000
  → Create Salesforce Opportunity
  → Alert Sales Director

Path B: SMB
  Condition: Amount between 1000 and 10000
  → Add to HubSpot
  → Send SMB Sequence

Path C: Self-Serve
  → Add to Email List Only
```

**Success/Failure:**
```
Path A: Success
  Condition: {{api_response.status}} equals "success"
  → Update Record as Processed
  → Send Confirmation

Path B: Failure
  Condition: {{api_response.status}} does not equal "success"
  → Log Error to Sheet
  → Send Alert to Slack
```

## Formatters

Transform data between steps. **Formatters don't count as tasks.**

### Text Formatters

**Capitalize**
```
Input: john doe
Output: John Doe
```

**Lowercase**
```
Input: [REDACTED_SECRET]
Output: [REDACTED_SECRET]
```

**Uppercase**
```
Input: new york
Output: NEW YORK
```

**Trim Whitespace**
```
Input: "  [REDACTED_SECRET]  "
Output: "[REDACTED_SECRET]"
```

**Replace**
```
Input: +1-555-123-4567
Find: -
Replace: (empty)
Output: +15551234567
```

**Split Text**
```
Input: John Doe
Separator: (space)
Segment Index: 0
Output: John
```

**Extract Pattern (Regex)**
```
Input: "Order #12345 confirmed"
Pattern: #(\d+)
Output: 12345
```

**Truncate**
```
Input: "Very long text here..."
Max Length: 10
Append: ...
Output: "Very long..."
```

### Number Formatters

**Format Number**
```
Input: 1234.5
Format: $#,##0.00
Output: $1,234.50
```

**Math Operations**
```
Operation: Add
Numbers: {{amount}}, 10
Output: (amount + 10)
```

```
Operation: Multiply
Numbers: {{quantity}}, {{price}}
Output: (quantity × price)
```

**Round Number**
```
Input: 3.14159
Decimal Places: 2
Output: 3.14
```

**Spreadsheet-Style Formula**
```
Formula: ({{price}} * {{quantity}}) - {{discount}}
Output: Calculated total
```

### Date/Time Formatters

**Format Date**
```
Input: 2024-01-15T14:30:00Z
Format: MMM DD, YYYY
Output: Jan 15, 2024
```

**Common Date Formats:**
| Format | Output |
|--------|--------|
| `YYYY-MM-DD` | 2024-01-15 |
| `MM/DD/YYYY` | 01/15/2024 |
| `MMM DD, YYYY` | Jan 15, 2024 |
| `MMMM D, YYYY` | January 15, 2024 |
| `ddd, MMM D` | Mon, Jan 15 |

**Adjust Date**
```
Input: 2024-01-15
Operation: Add 7 days
Output: 2024-01-22
```

```
Input: 2024-01-15
Operation: Subtract 1 month
Output: 2023-12-15
```

**Compare Dates**
```
Input A: {{trigger.start_date}}
Input B: {{zap_meta_human_now}}
Output: "before", "after", or "same"
```

### Utilities

**Lookup Table**
```
Input: US
Table:
  US → United States
  CA → Canada
  UK → United Kingdom
Output: United States
```

**Default Value**
```
Input: {{trigger.phone}}
Default: Not provided
Output: (phone if exists, else "Not provided")
```

**Pick from List**
```
Input: {{trigger.items}}
Index: 0
Output: First item
```

**Line Itemizer**
Create multiple line items from delimited string:
```
Input: "apple,banana,cherry"
Separator: ,
Output: ["apple", "banana", "cherry"]
```

### Sub-Zap (Reusable Flows)

Create reusable Zap chunks:

```
Main Zap:
  Trigger → Data
  Call Sub-Zap:
    Input: {{trigger.data}}
    → Sub-Zap processes
    ← Returns result
  Use {{sub_zap.result}}
```

## Digest (Batch)

Collect items over time, then process as batch.

### Setup
```
Action: Digest by Zapier
Mode: Collect items
Release: Every day at 9:00 AM
```

### Example: Daily Summary
```
Every new order:
  → Add to digest: {{order_id}}, {{amount}}

Daily at 9am:
  → Release digest
  → Send email with all orders
```

### Digest Modes

| Mode | Behavior |
|------|----------|
| Append | Add to end |
| Prepend | Add to start |
| Replace | Overwrite if key matches |

## Best Practices

1. **Filter early** — Don't waste tasks on records you'll discard
2. **Use paths for branching** — Cleaner than multiple Zaps
3. **Format before actions** — Clean data before sending
4. **Test each formatter** — Verify output matches expectations
5. **Default values** — Handle missing data gracefully


path: memory-template.md
content: # Memory Template — Zapier

Create `~/zapier/memory.md`:

```markdown
# Zapier Memory

## Status
status: ongoing
version: 1.0.0
last: YYYY-MM-DD
integration: pending

## Account
plan: free | starter | professional | team | company
api_access: yes | no
polling_speed: 15min | 2min | 1min

## Connected Apps
<!-- Apps they use frequently -->
- Google Sheets
- Slack
- Salesforce
- (add as discovered)

## Active Zaps
<!-- Zaps they've mentioned or created -->
Format: Trigger App → Action App (purpose)

## Common Patterns
<!-- Workflows they use repeatedly -->

## Preferences
complexity: simple | advanced
notifications: slack | email | both
error_handling: alert | silent

## Notes
<!-- Things to remember -->

---
*Updated: YYYY-MM-DD*
```

## Status Values

| Value | Meaning |
|-------|---------|
| `ongoing` | Still learning their stack |
| `complete` | Know their main workflows |
| `paused` | Don't ask more questions |

## Key Principles

- Learn apps from context
- Track successful patterns
- Note failed attempts (avoid repeating)
- Update `last` on each use


path: patterns.md
content: # Common Zapier Patterns

## Form → Database → Notification

**Use case:** Capture leads, notify team

```
Trigger: Typeform → New Entry
↓
Action 1: Find or Create HubSpot Contact
  Search: email
  Create if not found
↓
Action 2: Create Google Sheets Row
  Log all submissions
↓
Action 3: Send Slack Message
  Channel: #leads
  Message: "New lead: {{name}} from {{company}}"
↓
Action 4: Send Gmail
  To: {{trigger.email}}
  Subject: Thanks for reaching out!
```

## Payment → Fulfillment → Communication

**Use case:** E-commerce order flow

```
Trigger: Stripe → New Payment ⚡
↓
Filter: Amount greater than 0
↓
Action 1: Create Airtable Record
  Table: Orders
  Status: Pending
↓
Action 2: Send Gmail
  Order confirmation
↓
Action 3: Send Twilio SMS
  "Order confirmed! We'll notify when shipped."
↓
Action 4: Create Trello Card
  List: To Fulfill
```

## CRM Sync (Bidirectional)

**Use case:** Keep systems in sync

```
Zap A: Salesforce → HubSpot
  Trigger: New/Updated Salesforce Contact
  Action: Find or Create HubSpot Contact
  
Zap B: HubSpot → Salesforce  
  Trigger: New/Updated HubSpot Contact
  Action: Find or Create Salesforce Contact
  
⚠️ Add filter to prevent loops:
  Only continue if "Last Modified By" ≠ "Zapier"
```

## Scheduled Report

**Use case:** Daily/weekly summaries

```
Trigger: Schedule → Every Monday at 9 AM
↓
Action 1: Find Airtable Records
  Filter: Created This Week
↓
Action 2: Formatter → Spreadsheet Formula
  Calculate totals
↓  
Action 3: Send Email
  Weekly summary with stats
```

## Multi-Channel Content Distribution

**Use case:** Publish once, distribute everywhere

```
Trigger: WordPress → New Post Published
↓
Path A: Social Media
  → Create Twitter Thread
  → Post to LinkedIn
  → Create Facebook Post
  
Path B: Email
  → Add to Mailchimp Campaign Draft
  
Path C: Team
  → Send Slack Message to #marketing
```

## Approval Workflow

**Use case:** Manager approval required

```
Trigger: Form Submission (expense request)
↓
Action 1: Create Zapier Tables Record
  Status: Pending Approval
↓
Action 2: Send Slack to Manager
  Include Approve/Reject buttons (via Block Kit)
↓
Zap B: Slack Reaction Added ⚡
  If reaction = ✅
    → Update status to Approved
    → Process expense
    → Notify requester
  If reaction = ❌
    → Update status to Rejected
    → Notify requester with reason
```

## Error Handling Pattern

**Use case:** Graceful failure recovery

```
Trigger: Any
↓
Action 1: API Call (might fail)
  ☑️ Continue on error
↓
Path A: Success
  Condition: Response status = 200
  → Continue normal flow
  
Path B: Failure
  Condition: Response status ≠ 200
  → Log to Error Sheet
  → Send Slack Alert
  → Create follow-up task
```

## Deduplication Pattern

**Use case:** Prevent duplicate processing

```
Trigger: New Record
↓
Action 1: Find Record in Processed Table
  Search by unique ID
↓
Filter: Only continue if NOT found
↓
Action 2: Process the record
↓
Action 3: Add to Processed Table
  Store unique ID + timestamp
```

## Webhook Chain Pattern

**Use case:** Complex multi-stage processing

```
Zap A: Receive & Validate
  Trigger: Catch Hook
  → Validate data
  → POST to Zap B webhook

Zap B: Process & Enrich
  Trigger: Catch Hook (from Zap A)
  → API calls for enrichment
  → POST to Zap C webhook
  
Zap C: Store & Notify
  Trigger: Catch Hook (from Zap B)
  → Save to database
  → Send notifications
```

## Batch Processing Pattern

**Use case:** Aggregate items before processing

```
Zap A: Collect Items
  Trigger: Each new order
  → Add to Digest
  
Zap B: Process Batch
  Trigger: Schedule (daily at 6 PM)
  → Release Digest
  → Process all items together
  → Send single summary report
```

## Customer Health Monitoring

**Use case:** Proactive churn prevention

```
Trigger: Schedule → Daily
↓
Action 1: Find Airtable Records
  Filter: Last Activity > 30 days ago
↓
Loop: For each inactive customer
  → Check usage data
  → If usage < threshold:
    → Add to "At Risk" segment
    → Send re-engagement email
    → Create task for account manager
```

## Lead Scoring Pattern

**Use case:** Prioritize leads by engagement

```
Trigger: Any lead activity (email open, page visit, etc.)
↓
Action 1: Find Lead Record
↓
Action 2: Code (calculate score)
  score = currentScore
  if (activity == 'email_open') score += 5
  if (activity == 'demo_request') score += 50
  if (activity == 'pricing_page') score += 20
↓
Action 3: Update Lead Score
↓
Filter: If score > 100
  → Alert Sales Team
  → Move to "Hot Leads"
```

## Data Transformation Pattern

**Use case:** Clean and format data

```
Trigger: New messy data
↓
Formatter: Lowercase email
Formatter: Capitalize name
Formatter: Extract domain from email
Formatter: Parse date to standard format
Formatter: Calculate values
↓
Action: Store clean data
```

## Multi-Tenant Pattern

**Use case:** Different flows per customer

```
Trigger: New Event
↓
Lookup: Customer Settings Table
  Find by customer_id
↓
Path A: Customer uses Slack
  → Send to their Slack workspace
  
Path B: Customer uses Email
  → Send to their email
  
Path C: Customer uses Webhook
  → POST to their endpoint
```


path: setup.md
content: # Setup — Zapier

When `~/zapier/` doesn't exist, initialize memory and learn user context.

## Attitude

You're a workflow automation expert who can connect apps and eliminate manual work.

## Priority Order

### 1. First: Integration

Ask early:
- "Should I help whenever you mention automating tasks or connecting apps?"
- "Want me to suggest automations proactively when I notice repetitive workflows?"

Save integration preference to their main workspace memory.

### 2. Then: Understand Their Stack

Ask:
- "What apps do you use most that you'd like to connect?"
- "What manual tasks eat your time?"
- "Any workflows you've wanted to automate?"

### 3. Finally: Depth

Some want complex multi-step Zaps with filters and paths. Others want simple automations. Adapt.

## What to Save

In ~/zapier/memory.md:
- Apps they use (CRM, email, sheets, etc.)
- Common workflows they need
- Preference: simple vs advanced
- Zapier plan (affects polling speed)
- API access level

## When Ready

Once you know:
1. When to activate (integration preference)
2. Their main apps and workflows

...you can help design Zaps. Context builds over time.


path: tables.md
content: # Zapier Tables — No-Code Database

## Overview

Zapier Tables is a built-in database for storing and managing data without external tools.

| Feature | Description |
|---------|-------------|
| **Records** | Row-based data storage |
| **Fields** | Typed columns (text, number, date, etc.) |
| **Views** | Filtered/sorted perspectives |
| **Automations** | Native Zap triggers/actions |
| **API** | REST API for external access |

## Create Table

### Via Zapier UI
1. Go to tables.zapier.com
2. Click "Create Table"
3. Define fields and types
4. Import existing data (optional)

### Field Types

| Type | Description | Example |
|------|-------------|---------|
| Text | Single line | Name, Email |
| Long Text | Multi-line | Description, Notes |
| Number | Numeric | Amount, Quantity |
| Date | Date/time | Created At |
| Checkbox | Boolean | Is Active |
| Email | Email validation | Contact Email |
| URL | URL validation | Website |
| Phone | Phone validation | Contact Phone |
| Dropdown | Select from options | Status: Draft/Active/Done |
| Linked Record | Reference another table | Customer → Orders |
| Attachment | File upload | Invoice PDF |
| Button | Trigger automation | "Process" button |
| AI Field | Auto-generated | Sentiment, Summary |

## Tables API

### Authentication

```bash
export ZAPIER_TABLES_TOKEN="your_tables_api_token"
```

Get token from: Tables → Settings → API

### List Records

```bash
curl -H "Authorization: Bearer $ZAPIER_TABLES_TOKEN" \
  "https://tables.zapier.com/api/v1/tables/TABLE_ID/records"
```

### Get Single Record

```bash
curl -H "Authorization: Bearer $ZAPIER_TABLES_TOKEN" \
  "https://tables.zapier.com/api/v1/tables/TABLE_ID/records/RECORD_ID"
```

### Create Record

```bash
curl -X POST \
  -H "Authorization: Bearer $ZAPIER_TABLES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fields": {
      "Name": "John Doe",
      "Email": "[REDACTED_SECRET]",
      "Status": "Active",
      "Amount": 99.99
    }
  }' \
  "https://tables.zapier.com/api/v1/tables/TABLE_ID/records"
```

### Update Record

```bash
curl -X PATCH \
  -H "Authorization: Bearer $ZAPIER_TABLES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fields": {
      "Status": "Completed",
      "Processed At": "2024-01-15T10:30:00Z"
    }
  }' \
  "https://tables.zapier.com/api/v1/tables/TABLE_ID/records/RECORD_ID"
```

### Delete Record

```bash
curl -X DELETE \
  -H "Authorization: Bearer $ZAPIER_TABLES_TOKEN" \
  "https://tables.zapier.com/api/v1/tables/TABLE_ID/records/RECORD_ID"
```

### Filter Records

```bash
curl -H "Authorization: Bearer $ZAPIER_TABLES_TOKEN" \
  "https://tables.zapier.com/api/v1/tables/TABLE_ID/records?filter=Status%3DActive"
```

### Sort Records

```bash
curl -H "Authorization: Bearer $ZAPIER_TABLES_TOKEN" \
  "https://tables.zapier.com/api/v1/tables/TABLE_ID/records?sort=-Created%20At"
```

## Zap Integration

### Trigger: New Record

```
Trigger: Zapier Tables
Event: New Record
Table: [Your Table]
View: [Optional - only trigger for records in view]
```

### Trigger: Updated Record

```
Trigger: Zapier Tables
Event: Updated Record
Table: [Your Table]
```

### Action: Create Record

```
Action: Zapier Tables
Event: Create Record
Table: Contacts
Fields:
  Name: {{trigger.name}}
  Email: {{trigger.email}}
  Status: New
  Created At: {{zap_meta_human_now}}
```

### Action: Update Record

```
Action: Zapier Tables
Event: Update Record
Table: Contacts
Record: {{find_step.id}}
Fields:
  Status: Processed
  Processed At: {{zap_meta_human_now}}
```

### Action: Find Record

```
Action: Zapier Tables
Event: Find Record
Table: Contacts
Field: Email
Value: {{trigger.email}}
```

### Action: Find or Create

```
Action: Zapier Tables
Event: Find or Create Record
Table: Contacts
Search Field: Email
Search Value: {{trigger.email}}
-- If not found, create with: --
Name: {{trigger.name}}
Email: {{trigger.email}}
Status: New
```

## Button Fields

Buttons trigger Zaps when clicked.

### Setup
1. Add Button field to table
2. Create Zap with trigger: "Button Clicked in Table"
3. Button automatically links to Zap

### Example: Approve Record
```
Button: "Approve"
↓
Trigger: Button Clicked
→ Update Record: Status = "Approved"
→ Send Email: "Your request was approved"
```

## AI Fields

Auto-generate content using AI.

### Sentiment Analysis
```
Field: Sentiment (AI)
Source: Feedback field
Output: Positive/Negative/Neutral
```

### Summarization
```
Field: Summary (AI)
Source: Long Text field
Output: 2-3 sentence summary
```

### Categorization
```
Field: Category (AI)
Source: Description field
Categories: Bug, Feature Request, Question, Other
```

## Linked Records

Create relationships between tables.

### One-to-Many
```
Customers Table:
  - ID
  - Name
  - Email

Orders Table:
  - ID
  - Customer (Linked to Customers)
  - Total
  - Date
```

### Access Linked Data
In Zap:
```
{{trigger.Customer.Name}}
{{trigger.Customer.Email}}
```

## Views

Save filtered/sorted perspectives.

### Create View
1. Apply filters and sorts
2. Click "Save as View"
3. Name the view

### Use in Zaps
```
Trigger: New Record in View
Table: Orders
View: "Pending Orders"
```

Only triggers for records matching view criteria.

## Import/Export

### Import CSV
```
Tables → Import → Upload CSV
Map columns to fields
Review and confirm
```

### Export Data
```
Tables → Export → CSV
Download all records
```

### Sync with Google Sheets
Use Zap:
```
Trigger: New Row in Google Sheets
→ Create Record in Zapier Table

Trigger: New Record in Zapier Table
→ Create Row in Google Sheets
```

## Common Patterns

### CRM in Tables

```
Contacts Table:
  - Name (Text)
  - Email (Email)
  - Company (Text)
  - Status (Dropdown: Lead/Customer/Churned)
  - Last Contact (Date)
  - Notes (Long Text)
  - Follow Up (Button → triggers reminder Zap)
```

### Order Management

```
Orders Table:
  - Order ID (Number)
  - Customer (Linked to Contacts)
  - Items (Long Text)
  - Total (Number)
  - Status (Dropdown: Pending/Processing/Shipped/Delivered)
  - Process (Button → triggers fulfillment Zap)

Views:
  - Pending Orders (Status = Pending)
  - Today's Shipments (Status = Processing)
```

### Task Tracker

```
Tasks Table:
  - Title (Text)
  - Description (Long Text)
  - Assignee (Dropdown)
  - Due Date (Date)
  - Priority (Dropdown: Low/Medium/High)
  - Status (Dropdown: To Do/In Progress/Done)
  - Complete (Button → marks done + notifies)
```

## Best Practices

1. **Use appropriate field types** — Validates data automatically
2. **Create views for Zap triggers** — Filter at source, not in Zap
3. **Link tables** — Avoid data duplication
4. **Use buttons for actions** — One-click automation
5. **AI fields for enrichment** — Auto-categorize, summarize


path: triggers.md
content: # Triggers — Zapier

## Trigger Types

| Type | Latency | Use Case |
|------|---------|----------|
| **Polling** | 1-15 min | Apps without webhook support |
| **Instant (Webhook)** | Seconds | Real-time needs |
| **Schedule** | Exact time | Recurring tasks |
| **Catch Hook** | Instant | Custom integrations |
| **RSS** | 5-15 min | Blog/feed monitoring |

## Polling vs Instant

### Polling Triggers
- Zapier checks app periodically
- Free plan: every 15 minutes
- Paid plans: every 1-2 minutes
- Examples: New row in Google Sheets, New Salesforce lead

### Instant Triggers (Webhooks)
- App notifies Zapier immediately
- No delay
- Examples: New Stripe payment, New Slack message
- Look for ⚡ icon in Zapier UI

**Always prefer instant triggers when available.**

## Common Trigger Patterns

### New Record Created

**Google Sheets — New Row**
```
Trigger: New Spreadsheet Row
Spreadsheet: [Your Sheet]
Worksheet: [Sheet1]
```

**Airtable — New Record**
```
Trigger: New Record
Base: [Your Base]
Table: [Your Table]
View: [Optional - filter]
```

**Salesforce — New Lead**
```
Trigger: New Lead
Salesforce Account: [Connected]
```

### Record Updated

**Google Sheets — Updated Row**
```
Trigger: New or Updated Spreadsheet Row
Spreadsheet: [Your Sheet]
Worksheet: [Sheet1]
Trigger Column: [Column to watch]
```

**Airtable — Record Updated**
```
Trigger: New or Updated Record
Base: [Your Base]
Table: [Your Table]
```

### Form Submissions

**Typeform — New Entry**
```
Trigger: New Entry
Form: [Your Form]
```

**Google Forms — New Response**
```
Trigger: New Response in Spreadsheet
Spreadsheet: [Linked Sheet]
Worksheet: [Form Responses]
```

**JotForm — New Submission**
```
Trigger: New Submission
Form: [Your Form]
```

### Payments

**Stripe — New Payment** ⚡
```
Trigger: New Payment
Stripe Account: [Connected]
```

**PayPal — New Sale** ⚡
```
Trigger: Successful Sale
PayPal Account: [Connected]
```

### Communication

**Email — New Email**
```
Trigger: New Email
Label/Folder: [Optional]
```

**Slack — New Message** ⚡
```
Trigger: New Message Posted to Channel
Channel: [#channel-name]
```

**Gmail — New Email**
```
Trigger: New Email
Label: [Optional]
Search: [is:unread from:[REDACTED_SECRET]]
```

## Schedule Trigger

### Every Day
```
Trigger: Schedule by Zapier
Trigger Event: Every Day
Time of Day: 9:00 AM
Timezone: America/New_York
```

### Every Week
```
Trigger: Schedule by Zapier
Trigger Event: Every Week
Day of Week: Monday
Time of Day: 9:00 AM
```

### Every Month
```
Trigger: Schedule by Zapier
Trigger Event: Every Month
Day of Month: 1
Time of Day: 9:00 AM
```

### Custom Interval
```
Trigger: Schedule by Zapier
Trigger Event: Every Hour
```

Options: Every Hour, Every Day, Every Week, Every Month

## Catch Hook (Incoming Webhook)

Receive data from any system that can send HTTP requests.

### Setup
```
Trigger: Webhooks by Zapier
Trigger Event: Catch Hook
```

Zapier provides URL like:
```
https://hooks.zapier.com/hooks/catch/123456/abcdef/
```

### Send Test Data
```bash
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "[REDACTED_SECRET]",
    "amount": 99.99
  }' \
  "https://hooks.zapier.com/hooks/catch/123456/abcdef/"
```

### With Query Parameters
```bash
curl -X POST \
  "https://hooks.zapier.com/hooks/catch/123456/abcdef/?source=website&campaign=summer"
```

### Form Data
```bash
curl -X POST \
  -d "name=John Doe&email=[REDACTED_SECRET]" \
  "https://hooks.zapier.com/hooks/catch/123456/abcdef/"
```

## Catch Raw Hook

For custom payload parsing (XML, CSV, non-standard JSON).

```
Trigger: Webhooks by Zapier
Trigger Event: Catch Raw Hook
```

Returns raw body as string. Use Formatter to parse.

## Retrieve Poll

Fetch data from any URL on a schedule.

```
Trigger: Webhooks by Zapier
Trigger Event: Retrieve Poll
URL: https://api.example.com/data
Headers: Authorization: Bearer xxx
```

Zapier polls the URL every 1-15 minutes.

## RSS Trigger

Monitor RSS feeds for new items.

```
Trigger: RSS by Zapier
Feed URL: https://blog.example.com/feed.xml
```

- Checks every 5-15 minutes
- Triggers on new items only
- Good for blog monitoring, news alerts

## Trigger Data Structure

Every trigger provides data you can use in subsequent steps:

### Example: New Stripe Payment
```json
{
  "id": "ch_123",
  "amount": 9900,
  "currency": "usd",
  "customer": "cus_abc",
  "customer_email": "[REDACTED_SECRET]",
  "description": "Pro Plan",
  "status": "succeeded",
  "created": "2024-01-15T10:30:00Z"
}
```

### Example: New Google Sheets Row
```json
{
  "row_number": 42,
  "A": "John Doe",
  "B": "[REDACTED_SECRET]",
  "C": "2024-01-15",
  "spreadsheet_id": "1abc...",
  "worksheet_id": "Sheet1"
}
```

## Deduplication

Zapier tracks which records have already triggered to avoid duplicates.

**Dedupe Key** — Unique identifier for each record:
- Google Sheets: Row number
- Airtable: Record ID
- Stripe: Payment ID

**Important:** If you delete and re-add a row with same data, it WILL trigger again (different row number).

## Trigger Best Practices

1. **Test with sample data** — Always test before enabling
2. **Use instant when available** — ⚡ triggers are faster and more reliable
3. **Add filters after trigger** — Don't process unwanted records
4. **Watch for trigger loops** — Trigger from same app you write to can loop
5. **Consider rate limits** — High-volume triggers can burn tasks quickly


path: webhooks.md
content: # Webhooks — Zapier

## Webhook Types

| Type | Direction | Use Case |
|------|-----------|----------|
| **Catch Hook** | Incoming | Receive data from external systems |
| **Catch Raw Hook** | Incoming | Receive non-JSON data (XML, CSV) |
| **Retrieve Poll** | Incoming (Pull) | Fetch data from URL on schedule |
| **POST/PUT/GET** | Outgoing | Send data to external systems |
| **Custom Request** | Outgoing | Full control over HTTP request |

## Incoming Webhooks

### Catch Hook (JSON)

**Setup:**
```
Trigger: Webhooks by Zapier
Event: Catch Hook
```

Zapier provides webhook URL:
```
https://hooks.zapier.com/hooks/catch/123456/abcdef/
```

**Test with curl:**
```bash
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "event": "user.created",
    "user": {
      "id": 12345,
      "email": "[REDACTED_SECRET]",
      "name": "John Doe",
      "plan": "premium"
    },
    "timestamp": "2024-01-15T10:30:00Z"
  }' \
  "https://hooks.zapier.com/hooks/catch/123456/abcdef/"
```

**Response:**
```json
{
  "id": "abc123",
  "request_id": "xyz789",
  "status": "success"
}
```

### With Query Parameters

```bash
curl -X POST \
  "https://hooks.zapier.com/hooks/catch/123456/abcdef/?source=shopify&event=order" \
  -H "Content-Type: application/json" \
  -d '{"order_id": 9999, "total": 149.99}'
```

Access in Zap:
- `{{querystring__source}}` → shopify
- `{{querystring__event}}` → order
- `{{order_id}}` → 9999

### Catch Raw Hook

For non-JSON payloads (XML, CSV, custom formats).

**Setup:**
```
Trigger: Webhooks by Zapier
Event: Catch Raw Hook
```

**Receive XML:**
```bash
curl -X POST \
  -H "Content-Type: application/xml" \
  -d '<?xml version="1.0"?>
  <order>
    <id>12345</id>
    <customer>[REDACTED_SECRET]</customer>
  </order>' \
  "https://hooks.zapier.com/hooks/catch/123456/raw/"
```

Access: `{{raw_body}}` contains entire payload as string.
Parse with Code step or Formatter.

### Retrieve Poll

Pull data from any URL on Zapier's schedule.

**Setup:**
```
Trigger: Webhooks by Zapier
Event: Retrieve Poll
URL: https://api.yourapp.com/new-orders
Headers: [REDACTED_SECRET]
```

Zapier polls every 1-15 minutes depending on plan.

**Expected Response:**
```json
[
  {"id": 1, "name": "Order 1"},
  {"id": 2, "name": "Order 2"}
]
```

Each array item triggers the Zap once.

## Outgoing Webhooks

### POST Request

**Action:**
```
Action: Webhooks by Zapier
Event: POST
URL: https://api.yourapp.com/webhook
Payload Type: JSON
Data:
  event: new_user
  user_id: {{trigger.id}}
  email: {{trigger.email}}
  timestamp: {{zap_meta_human_now}}
```

### With Authentication

**API Key in Header:**
```
Headers:
  [REDACTED_SECRET]
  X-Custom-Header: value
```

**Basic Auth:**
```
Basic Auth:
  Username: api_user
  [REDACTED_SECRET]
```

### PUT Request

```
Action: Webhooks by Zapier
Event: PUT
URL: https://api.yourapp.com/users/{{trigger.user_id}}
Payload Type: JSON
Data:
  status: active
  updated_at: {{zap_meta_human_now}}
```

### GET Request

```
Action: Webhooks by Zapier
Event: GET
URL: https://api.yourapp.com/users/{{trigger.user_id}}
Headers:
  [REDACTED_SECRET]
```

### Custom Request

Full control over HTTP method, headers, and body.

```
Action: Webhooks by Zapier
Event: Custom Request
Method: PATCH
URL: https://api.yourapp.com/orders/{{trigger.order_id}}
Headers:
  [REDACTED_SECRET]
  Content-Type: application/json
  X-Request-ID: {{zap_meta_id}}
Data (Raw):
  {"status": "shipped", "tracking": "{{trigger.tracking_number}}"}
```

## Response Handling

### Access Response Data

After webhook action, response is available:
- `{{webhook_response.status}}` — HTTP status code
- `{{webhook_response.id}}` — Response body field
- `{{webhook_response.data.user.email}}` — Nested field

### Handle Different Status Codes

```
Path A: Success (2xx)
  Condition: Webhook Response Status Code equals 200
  → Continue normal flow

Path B: Client Error (4xx)
  Condition: Webhook Response Status Code equals 400
  → Log error
  → Send alert

Path C: Server Error (5xx)
  Condition: Webhook Response Status Code greater than 499
  → Retry later
```

## Webhook Security

### Verify Incoming Webhooks

**With Shared Secret:**

Many apps send signature header. Verify in Code step:

```javascript
const crypto = require('crypto');
const [REDACTED_SECRET]';
const signature = inputData.signature;
const payload = inputData.raw_body;

const expectedSig = crypto
  .createHmac('sha256', secret)
  .update(payload)
  .digest('hex');

output = [{
  valid: signature === expectedSig
}];
```

### IP Allowlisting

Zapier webhook IPs: https://help.zapier.com/hc/en-us/articles/8496288690317

Add to your firewall allowlist for incoming webhooks from Zapier.

## Webhook Best Practices

### 1. Return 200 Quickly

Zapier waits 30 seconds max. If your endpoint is slow:
- Queue the work
- Return 200 immediately
- Process asynchronously

### 2. Handle Retries

Zapier retries failed webhooks with exponential backoff.
Design for idempotency — same webhook twice shouldn't duplicate data.

### 3. Log Everything

```
Action: Create Google Sheets Row
Spreadsheet: Webhook Logs
Data:
  Timestamp: {{zap_meta_human_now}}
  Zap ID: {{zap_meta_id}}
  Trigger Data: {{trigger.raw_body}}
  Response: {{webhook_response}}
```

### 4. Timeout Handling

If target is slow:
```
Action: Webhooks by Zapier
☑️ Unfurl URLs (increases timeout slightly)
```

Or use async pattern:
1. Send webhook
2. Target returns 200 + job_id
3. Separate Zap polls for result

### 5. Test Mode

Always test with non-production data:
```bash
curl -X POST \
  -H "X-Test-Mode: true" \
  -d '{"test": true}' \
  "https://hooks.zapier.com/hooks/catch/123456/abcdef/"
```

Handle in your app:
```python
if request.headers.get('X-Test-Mode'):
    return {"status": "test_success"}
```

## Common Webhook Patterns

### Forward to Multiple Services

```
Trigger: Catch Hook
→ POST to Service A
→ POST to Service B
→ POST to Service C
```

### Transform and Forward

```
Trigger: Catch Hook
→ Code: Transform data
→ POST transformed data
```

### Webhook to Email

```
Trigger: Catch Hook
→ Send Email:
  To: [REDACTED_SECRET]
  Subject: New webhook: {{trigger.event}}
  Body: {{trigger.raw_body}}
```

### Webhook Chain

```
Zap A:
  Trigger: Form submission
  → POST to Zap B webhook

Zap B:
  Trigger: Catch Hook (from Zap A)
  → Complex processing
  → POST to Zap C webhook
```


Security scan verdicts — ClawScan: suspicious | static analysis: suspicious | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)