Automatically save WhatsApp logs or contact data from WMS Personal into your own Google Sheet using a webhook.
When a WhatsApp message or event triggers your webhook, WMS Personal will send a POST request containing message data to your specified URL. Using Google Apps Script, you can receive this data and store it directly into your Google Sheet β hosted for free by Google.
Phone | Message | TimestampIn your Sheet, go to Extensions β Apps Script and paste this code:
function doPost(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = JSON.parse(e.postData.contents);
// Append webhook data to the sheet
sheet.appendRow([
data.from || '',
data.message || '',
new Date(data.timestamp * 1000)
]);
// Send a reply message
var reply = "Thank you. Message Received.";
// Return a JSON response (same format your WhatsApp system expects)
return ContentService
.createTextOutput(JSON.stringify({ reply: reply }))
.setMimeType(ContentService.MimeType.JSON);
return ContentService.createTextOutput("OK");
}
This script receives incoming webhook data from WMS Personal and writes it as a new row into your Sheet. It then sends a reply back "Thank you. Message Received."
https://script.google.com/macros/s/AKfycbx123abcXYZ/execNow, every incoming WhatsApp message will automatically be sent to your Google Sheet π
Hereβs an example of what WMS Personal will send to your webhook URL:
{
"user_id": 123,
"device_id": "abc123",
"whatsapp_id": "60123456789@s.whatsapp.net",
"from": "60123456789",
"message": "Hi, can I get more info?",
"message_id": "XYZ987654",
"timestamp": 1722337200
}
user_id or message_id to track more detailsIt only takes 5 minutes to set up your free Google-hosted webhook β no server required!
Create Your Free Account