Automation Tutorial

How to Connect WhatsApp to Google Sheets via Webhooks

Sync incoming customer inquiries, lead phone numbers, and conversation logs straight into Google Sheets in real-time. No expensive Zapier subscriptions required.

Why Sync WhatsApp Leads to Google Sheets?

Google Sheets remains the world's most accessible collaborative database. Connecting your WhatsApp stream to a Google Sheet allows your sales managers to:

  • Maintain a backup of all customer phone numbers and lead dates.
  • Trigger external automations via Make.com, Zapier, or internal dashboards.
  • Review sales agent performance without granting raw phone access.

Step 1: Set Up Google Apps Script Webhook

Create a new Google Sheet, click Extensions > Apps Script, and paste the following snippet:

function doPost(e) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var data = JSON.parse(e.postData.contents);
  sheet.appendRow([
    new Date(),
    data.senderPhone || '',
    data.senderName || '',
    data.messageText || '',
    data.leadStatus || 'New'
  ]);
  return ContentService.createTextOutput(JSON.stringify({ status: "success" }))
    .setMimeType(ContentService.MimeType.JSON);
}

Step 2: Deploy as a Web App

Click Deploy > New deployment in Google Apps Script. Select Web app, set Who has access to Anyone, and copy the generated Webhook URL.

Step 3: Paste URL into WhatsPilot Webhooks

In your WhatsPilot Webhook Settings:

  1. Paste your Google Apps Script URL.
  2. Select the event trigger: message:received or lead:created.
  3. Send a test payload — you'll immediately see a new row appear in your Google Sheet!

Two-Way Sync: Triggering WhatsApp from Sheets

You can also send messages back out! When a new row is added in Google Sheets, call WhatsPilot's REST API endpoint with the phone number and message copy. Your connected WhatsApp line will dispatch the message instantly with full delay jitter protection.

Put this playbook to work.

WhatsPilot answers customers 24/7, sends broadcasts at a human pace and tracks every lead. Free for 3 days, then from ₹499/month.

Start free trial