DEV Community

Ajay Radadiya
Ajay Radadiya

Posted on

Connecting Gravity Forms to n8n Using Webhooks (Step-by-Step)

If you’re using Gravity Forms on WordPress and want to connect form submissions to CRMs, Slack, Google Sheets, or any external system, pairing it with n8n via webhooks gives you a powerful, flexible, and cost-effective automation setup.

In this guide, you’ll learn how to send Gravity Forms submissions to n8n using webhooks — without relying on expensive third-party automation tools.


🧰 Tools Used

  • :contentReference[oaicite:0]{index=0} – WordPress form builder
  • :contentReference[oaicite:1]{index=1} – Open-source workflow automation platform
  • Webhooks – To send form data from WordPress to n8n

🎯 What You’ll Build

When someone submits a form:

  1. Gravity Forms sends submission data to an n8n webhook.
  2. n8n receives and processes the data.
  3. You can:
    • Send data to a CRM
    • Add a row in Google Sheets
    • Notify a Slack channel
    • Trigger email automations
    • Or run any custom workflow logic

Step 1: Create a Webhook in n8n

1️⃣ Add a Webhook Node

  1. Log in to your n8n instance.
  2. Create a new workflow.
  3. Add a Webhook node.
  4. Configure:
    • HTTP Method: POST
    • Path: gravity-forms

n8n will generate a webhook URL like:

Production:

https://your-n8n-instance.com/webhook/gravity-forms

Test (local/dev):

http://localhost:5678/webhook-test/gravity-forms

Use the production URL once your workflow is activated.

2️⃣ Activate the Workflow

Click Activate so the webhook becomes publicly accessible.


Step 2: Send Gravity Forms Data to n8n

You have two main options.


✅ Option A: Use Gravity Forms Webhooks Add-On (Recommended)

If your license includes the Webhooks Add-On:

  1. Go to Forms → Settings → Webhooks
  2. Click Add New
  3. Configure:
    • Request URL: Your n8n webhook URL
    • Method: POST
    • Request Format: JSON

Example JSON Body


json
{
  "name": "{Name:1}",
  "email": "{Email:2}",
  "message": "{Message:3}"
}

Save and submit a test entry.

✅ Option B: Use gform_after_submission (No Add-On Required)

If you don’t have the Webhooks Add-On, add this to your theme’s functions.php or a custom plugin:

add_action('gform_after_submission', 'send_to_n8n', 10, 2);
function send_to_n8n($entry, $form) {

    $webhook_url = 'https://your-n8n-instance.com/webhook/gravity-forms';

    $body = [
        'name'    => rgar($entry, '1'),
        'email'   => rgar($entry, '2'),
        'message' => rgar($entry, '3'),
    ];

    wp_remote_post($webhook_url, [
        'method'  => 'POST',
        'body'    => json_encode($body),
        'headers' => [
            'Content-Type' => 'application/json',
        ],
    ]);
}

Replace field IDs (1, 2, 3) with your actual form field IDs.

Step 3: Process the Data in n8n

Once the webhook receives data, you can build your workflow.

Example Workflow
Webhook → Set → Google Sheets → Slack

Or:

Webhook → IF → CRM → Email
Access Submitted Data

Inside n8n nodes, reference values like:

{{$json["email"]}}
{{$json["name"]}}
Step 4: Secure Your Webhook (Important)

Webhooks are public endpoints by default. Always add protection.

Option 1: Add a Secret Token

Send a token from Gravity Forms:

{
  "name": "{Name:1}",
  "email": "{Email:2}",
  "token": "my-secret-key"
}

Then validate using an IF node in n8n:

{{$json["token"]}} equals my-secret-key
Option 2: Use Header Authentication

Send a custom header from WordPress:

'headers' => [
    'Content-Type'     => 'application/json',
    'X-Webhook-Secret' => 'my-secret-key',
],

Then check it inside n8n before continuing the workflow.

Step 5: Test the Automation

Submit your form.

Open n8n executions.

Confirm data is received and processed.

Verify the final integration works.

Common Issues

Workflow not activated

Using test URL instead of production URL

Incorrect field IDs

Invalid JSON formatting
Enter fullscreen mode Exit fullscreen mode

Top comments (0)