{
  "schema_version": "1.0.0",
  "id": "zapier-tables-mini-crm",
  "title": "Keep a small CRM in Zapier Tables",
  "category": "lead-gen-crm",
  "difficulty": "beginner",
  "featured": true,
  "description": "Log each Google Forms enquiry in a Zapier Tables CRM, count repeat enquiries from the same email, and announce only new contacts in Slack.",
  "tags": [
    "crm",
    "zapier-tables",
    "google-forms",
    "slack",
    "small-business"
  ],
  "apps": [
    "Google Forms",
    "Code by Zapier",
    "Zapier Tables",
    "Paths by Zapier",
    "Slack",
    "Formatter by Zapier"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 7 steps after the trigger",
      "Paths by Zapier",
      "Formatter by Zapier"
    ]
  },
  "tasks": {
    "typical": 2,
    "max": 2
  },
  "trigger": {
    "app": "Google Forms",
    "event": "New Form Response",
    "kind": "polling",
    "title": "New enquiry form response",
    "why": "Fires for each new response to the enquiry form.",
    "config": {
      "Form": "Work with us"
    },
    "outputs": [
      "response_id",
      "timestamp",
      "name",
      "email",
      "company",
      "interest",
      "notes"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "domain",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Read the email domain",
      "why": "Works out the company domain and whether the address is a free mailbox, so the table can be sorted by real companies.",
      "code": {
        "language": "javascript",
        "module": "email-domain",
        "file": "code/email-domain.js"
      },
      "input_data": {
        "email": "{{trigger.email}}"
      },
      "outputs": [
        "valid",
        "domain",
        "is_free_provider",
        "is_role_address",
        "company_guess",
        "website"
      ]
    },
    {
      "key": "find",
      "kind": "search",
      "app": "Zapier Tables",
      "event": "Find Record",
      "title": "Look the email up in the CRM table",
      "why": "Searches the Contacts table by email, so the Zap knows whether this is a new contact or a repeat enquiry.",
      "fields": {
        "Table": "Contacts",
        "Lookup Field": "email",
        "Lookup Value": "{{trigger.email}}",
        "Should this step be considered a \"success\" when nothing is found?": "Yes"
      },
      "outputs": [
        "id",
        "_zap_search_was_found_status",
        "touch_count",
        "first_seen"
      ]
    },
    {
      "key": "route",
      "kind": "paths",
      "app": "Paths by Zapier",
      "event": "Split into paths",
      "title": "New contact or repeat",
      "why": "Exactly one path runs: the lookup either found the email or it did not.",
      "paths": [
        {
          "name": "New contact",
          "conditions": [
            [
              {
                "field": "{{find._zap_search_was_found_status}}",
                "operator": "(Boolean) Is false"
              }
            ]
          ],
          "usually": true,
          "steps": [
            {
              "key": "create",
              "kind": "action",
              "app": "Zapier Tables",
              "event": "Create Record",
              "title": "Add the contact to the table",
              "why": "One record per email, with the domain fields filled in.",
              "fields": {
                "Table": "Contacts",
                "name": "{{trigger.name}}",
                "email": "{{trigger.email}}",
                "company": "{{trigger.company}}",
                "domain": "{{domain.domain}}",
                "free_mailbox": "{{domain.is_free_provider}}",
                "interest": "{{trigger.interest}}",
                "notes": "{{trigger.notes}}",
                "status": "new",
                "first_seen": "{{trigger.timestamp}}",
                "last_seen": "{{trigger.timestamp}}",
                "touch_count": "1"
              },
              "outputs": [
                "id"
              ]
            },
            {
              "key": "announce",
              "kind": "action",
              "app": "Slack",
              "event": "Send Channel Message",
              "title": "Announce the new contact",
              "why": "Only new contacts are announced, so the channel does not repeat people.",
              "fields": {
                "Channel": "#new-enquiries",
                "Message Text": "New contact: {{trigger.name}} ({{trigger.company}}) wants {{trigger.interest}}. Notes: {{trigger.notes}}",
                "Send as a bot?": "Yes",
                "Bot Name": "Zap alerts",
                "Include a link to this Zap?": "No"
              },
              "outputs": [
                "ts",
                "permalink"
              ]
            }
          ]
        },
        {
          "name": "Repeat enquiry",
          "conditions": [
            [
              {
                "field": "{{find._zap_search_was_found_status}}",
                "operator": "(Boolean) Is true"
              }
            ]
          ],
          "usually": false,
          "steps": [
            {
              "key": "count",
              "kind": "formatter",
              "app": "Formatter by Zapier",
              "event": "Numbers",
              "title": "Add one to the touch count",
              "why": "Formatter does the arithmetic; Zapier Tables has no increment field.",
              "fields": {
                "Transform": "Perform Math Operation",
                "Operation": "Add",
                "Input": "{{find.touch_count}}, 1"
              },
              "outputs": [
                "output"
              ]
            },
            {
              "key": "update",
              "kind": "action",
              "app": "Zapier Tables",
              "event": "Update Record",
              "title": "Update the existing contact",
              "why": "Keeps one record per person and records when they came back and what they asked for.",
              "fields": {
                "Table": "Contacts",
                "Record": "{{find.id}}",
                "last_seen": "{{trigger.timestamp}}",
                "touch_count": "{{count.output}}",
                "interest": "{{trigger.interest}}",
                "notes": "{{trigger.notes}}"
              },
              "outputs": [
                "id"
              ]
            }
          ]
        }
      ]
    }
  ]
}
