Connecting CRM/Make.com

Webhook Integration Overview #

You can send new leads or conversation data from TalkativeWP to any external system using a webhook URL. This is useful for:

  • Saving leads to your CRM (e.g. HubSpot, Salesforce, Make, Zapier)
  • Logging user input or chat summaries
  • Triggering automations (email flows, notifications, etc.)

What Data is Sent via Webhook? #

Once a user starts a conversation and agrees to the terms, the plugin sends a POST request to your configured webhook URL with the following fields:

FieldTypeDescription
namestringThe name entered by the user
phonestringOptional phone number (if enabled)
consent_givenbooleanWhether the user agreed to your terms
session_idstringUnique identifier for the chat session
messagesarrayA full array of message objects
messages[].role“user” or “assistant”Who wrote the message
messages[].contentstringText of the message
timestampISO dateDate and time of the first message

Requirements #

  • You must provide a valid HTTPS endpoint.
  • The webhook will only be triggered after the user consents and sends a message.
  • Ensure your server supports JSON POST requests.

What’s Not Supported Yet? #

  • No retry mechanism if the webhook fails.
  • No authentication headers (coming in future versions).
  • No field-level customization (preset payload only).

🎁 Bonus: Google Sheets + Email Notification Script #

You can connect TalkativeWP to Google Sheets (e.g., using Make.com or a custom webhook) and then use Apps Script to trigger email notifications whenever a new lead is added.

Here’s a full working script you can use in Apps Script inside your Google Sheet:

/**
 * Sends a styled HTML email when a new row is added to a Google Sheet.
 * Parses the chat summary JSON, formats it, and sends it to your email.
 * Make sure to update the sheet name and target email.
 */
function sendNotificationOnRowAdd(e) {
  var TARGET_SHEET_NAME = "Sheet1"; // <-- Replace with your actual sheet name

  if (e.changeType === 'INSERT_ROW') {
    var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = spreadsheet.getSheetByName(TARGET_SHEET_NAME);

    if (!sheet) {
      Logger.log("Error: Sheet '" + TARGET_SHEET_NAME + "' not found.");
      return;
    }

    var recipientEmail = "your@email.com"; // <-- Replace with your target email

    var lastRow = sheet.getLastRow();
    var name = sheet.getRange(lastRow, 1).getValue();
    var phoneRaw = sheet.getRange(lastRow, 2).getValue();
    var chatJsonRaw = sheet.getRange(lastRow, 5).getValue();

    var phoneDisplay = String(phoneRaw);
    var phoneLink = "tel:" + phoneDisplay.replace(/[^+\d]/g, '');

    // Normalize phone for Israel format
    var cleanedPhone = phoneDisplay.replace(/[-\s]/g, '');
    if (/^\d{9}$/.test(cleanedPhone)) {
      phoneDisplay = '0' + cleanedPhone;
      phoneLink = "tel:+972" + cleanedPhone;
    } else if (cleanedPhone.startsWith('0')) {
      phoneLink = "tel:+972" + cleanedPhone.substring(1);
    }

    var formattedChat = "";
    if (chatJsonRaw && typeof chatJsonRaw === 'string') {
      try {
        var cleanedJson = chatJsonRaw.replace(/\\\\"/g, '\\"');
        var chatMessages = JSON.parse(cleanedJson);

        if (Array.isArray(chatMessages)) {
          formattedChat += "<hr><b>Chat Summary:</b><br>";
          chatMessages.forEach(function(msg) {
            var sender = msg.role === 'user' ? 'User' : 'Assistant';
            var content = msg.content.replace(/\n/g, '<br>');
            formattedChat += "<b>" + sender + ":</b> " + content + "<br>";
          });
        }
      } catch (error) {
        Logger.log("Error parsing chat JSON: " + error);
        formattedChat = "<b>Chat summary could not be parsed.</b><br>" + chatJsonRaw;
      }
    }

    var htmlBody =
      '<div dir="rtl" style="text-align: right; font-family: Arial;">' +
      'New lead received:<br><br>' +
      '<b>Name:</b> ' + name + '<br>' +
      '<b>Phone:</b> <a href="' + phoneLink + '">' + phoneDisplay + '</a><br>' +
      formattedChat +
      '<br>This is an automated message.' +
      '</div>';

    var subject = "📩 New Lead from TalkativeWP";

    try {
      MailApp.sendEmail({
        to: recipientEmail,
        subject: subject,
        htmlBody: htmlBody
      });
    } catch (err) {
      Logger.log("Error sending email: " + err);
    }
  }
}

Note: Replace "your@email.com" with your actual email address.

What are your feelings

Updated on 25 April 2025
I am here to help chat icon
Chat with TalkativeWP Bot
TalkativeWP Bot on it...