{
  "id": "uEt2jlzqALwDOkvt",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Save Contact Form Submissions to Google Sheets and Reply from Slack",
  "tags": [],
  "nodes": [
    {
      "id": "49fac416-62fd-4655-884f-28960262343d",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -816,
        -144
      ],
      "parameters": {
        "options": {},
        "formTitle": "Inquiry Form",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Name",
              "placeholder": "your name",
              "requiredField": true
            },
            {
              "fieldLabel": "Email address",
              "placeholder": "user@example.com",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Meesage",
              "placeholder": "request for me",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Thanks for visiting! You can contact me here."
      },
      "typeVersion": 2.3
    },
    {
      "id": "fa3bc877-165b-475b-8108-a9b3384555ce",
      "name": "Send a message",
      "type": "n8n-nodes-base.slack",
      "position": [
        80,
        -144
      ],
      "parameters": {
        "select": "channel",
        "blocksUi": "={\n\t\"blocks\": [\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"{{ $('Config').item.json.slackMessage.replaceAll('\\n', '\\\\n') }}\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"type\": \"divider\"\n\t\t},\n\t\t{\n\t\t\t\"type\": \"actions\",\n\t\t\t\"elements\": [\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"button\",\n\t\t\t\t\t\"text\": {\n\t\t\t\t\t\t\"type\": \"plain_text\",\n\t\t\t\t\t\t\"text\": \"Contact\",\n\t\t\t\t\t\t\"emoji\": true\n\t\t\t\t\t},\n\t\t\t\t\t\"value\": \"click_contact\",\n\t\t\t\t\t\"url\": \"{{ $('Config').item.json.contactWebhookUrl }}?name={{ $('Config').item.json.name }}&emailAddress={{ $('Config').item.json.emailAddress }}\"\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t]\n}",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "Please change here"
        },
        "messageType": "block",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "9da5c499-e6d6-4b45-bf33-e0d71f63f884",
      "name": "Append row in inquiry list",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -144,
        -144
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "Email address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Meesage",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Meesage",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "submittedAt",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "submittedAt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "formMode",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "formMode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jX72-4p9V3Ij43ab5WMgnGnyyGh1YQ47ZYKdAKGlBPg/edit#gid=0",
          "cachedResultName": "sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jX72-4p9V3Ij43ab5WMgnGnyyGh1YQ47ZYKdAKGlBPg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jX72-4p9V3Ij43ab5WMgnGnyyGh1YQ47ZYKdAKGlBPg/edit?usp=drivesdk",
          "cachedResultName": "Web page summary"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e48b932b-ee4f-4267-a1a3-df44d0cdd0e1",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "position": [
        -592,
        -144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "17d30704-8a03-4c44-ab1d-223f4985fbc3",
              "name": "name",
              "type": "string",
              "value": "={{ $json['Name'] }}"
            },
            {
              "id": "6fa5b8bd-802c-44b7-b6df-23eae37c5445",
              "name": "emailAddress",
              "type": "string",
              "value": "={{ $json['Email address'] }}"
            },
            {
              "id": "11df114a-2f90-461b-b07c-c48db9619e9c",
              "name": "message",
              "type": "string",
              "value": "={{ $json.Meesage }}"
            },
            {
              "id": "5962421d-0145-414c-846b-4bf2f844f4be",
              "name": "slackMessage",
              "type": "string",
              "value": "=:envelope: New Inquiry Received\n```\nName:  {{ $json['Name'] }}\nEmail address: {{ $json['Email address'] }}\nMessage: {{ $json.Meesage }}\n```"
            },
            {
              "id": "e42a756e-abb9-4554-88e9-51f0d03c1801",
              "name": "contactWebhookUrl",
              "type": "string",
              "value": "https://your.app.n8n.cloud/webhook/uuid"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "35690fce-57be-45ae-9615-e62bed8ddc19",
      "name": "NewRecord",
      "type": "n8n-nodes-base.code",
      "position": [
        -368,
        -144
      ],
      "parameters": {
        "jsCode": "const item = $input.first().json\n\nreturn [{\n  json: {\n    name: item.name,\n    emailAddress: item.emailAddress,\n    message: item.message\n  }\n}]"
      },
      "typeVersion": 2
    },
    {
      "id": "12d6a7be-4331-4f11-8ed1-a3813ea05878",
      "name": "EmailContent",
      "type": "n8n-nodes-base.code",
      "position": [
        -592,
        80
      ],
      "parameters": {
        "jsCode": "const raw = $input.first().json\nconst { name, emailAddress } = raw.query\n\nif (!name || !emailAddress) {\n  return []\n}\n\nreturn [{\n  json: {\n    name,\n    emailAddress\n  }\n}]"
      },
      "typeVersion": 2
    },
    {
      "id": "0099b4a4-6c3b-42e0-b6d6-d705359eea68",
      "name": "Send a email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -368,
        80
      ],
      "parameters": {
        "sendTo": "={{ $json.emailAddress }}",
        "message": "=Dear {{ $json.name }},\n\nThank you for reaching out to us.\nWe have received your inquiry and will get back to you shortly.\n\nBest regards,\n\nThe Support Team",
        "options": {},
        "subject": "We received your message",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1a659a13-1bb0-4525-9fb4-c1c382a6cfc0",
      "name": "Form ending",
      "type": "n8n-nodes-base.form",
      "position": [
        304,
        -144
      ],
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Thank you for contacting us.",
        "completionMessage": "We have received your message and will get back to you shortly."
      },
      "typeVersion": 2.3
    },
    {
      "id": "152de56b-c771-4167-ae30-7a58872d501b",
      "name": "ContactWebhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -816,
        80
      ],
      "parameters": {
        "path": "0b9182aa-4014-4044-a9c2-3c993e69d643",
        "options": {},
        "authentication": "basicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "9be0aff2-6371-4a3f-a996-5a8c9f992279",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -288
      ],
      "parameters": {
        "width": 640,
        "height": 560,
        "content": "## How it works\n\nThis workflow is triggered when the contact form is submitted.\n\nIt automatically saves the inquiry details to Google Sheets and sends a notification to Slack.\nYou can then review the inquiry and reply directly from Slack using the `Contact` button.\n\n## How to use\n\n* Open the `Gmail` node and set up the Credential.\n* Open the `Google Sheets` node and set up the Credential.\n* Open the `Slack` node and set up the Credential to allow sending messages.\n    * You can create a new Slack App [here](https://api.slack.com/apps).\n* Open the `ContactWebhook` node and configure Basic Auth.\n* Open the `Config` node and update the `contactWebhookUrl` parameter to match the Production URL from the `ContactWebhook` node.\n\n## Customizing this workflow\n\n* You can customize the Slack notification message in the `Config` node.\n* You can modify the reply email body in the `Gmail` node.\n    * We recommend including a scheduling link (e.g., to book a meeting)."
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "db0e3538-d785-4fbc-9350-9bcf85ff51a7",
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "NewRecord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NewRecord": {
      "main": [
        [
          {
            "node": "Append row in inquiry list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "EmailContent": {
      "main": [
        [
          {
            "node": "Send a email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ContactWebhook": {
      "main": [
        [
          {
            "node": "EmailContent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Form ending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in inquiry list": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}