SMS Hooks is an app that listens for incoming SMS messages then sends a POST
request to your webhook URL containing the SMS details.
⚠️ Warning: Since SMS messages can contain sensitive information, this app only allows HTTPS protocol URLs.
Request Body
For each SMS message a POST request is made with a JSON body containing the SMS message and its metadata.
{
"body": "<SMS Message>",
"from": "<SMS Sender>",
"timestamp": 1598773970403, // Milliseconds
}
Receiving SMS Webhooks in Google Sheets
If you have a Google account you can combine Google Sheets with Google Apps Script to create a simple webhook server that responds to the SMS webhooks and appends each SMS as a new record in the spreadsheet.
-
Create a spreadsheet in Google Sheets.
-
Create a sheet-bound Google Apps Script by selecting Extensions > Apps Script from the spreadsheet.
-
This should open the newly created Google Apps Script project. Inside the
Code.gs
file delete any existing code. -
Add the following function to the file:
/** * This function is executed when a POST request is made to the published * script URL. It appends the SMS details as a row in first sheet in the * spreadsheet bound to the script. * * For documentation about the request parameter `e` please see: * https://developers.google.com/apps-script/guides/web#request_parameters */ function doPost(e) { let sms = JSON.parse(e.postData.contents); let sheet = SpreadsheetApp.getActive().getSheets()[0]; sheet.appendRow([sms.timestamp, sms.from, sms.body]); return ContentService .createTextOutput(JSON.stringify({})) .setMimeType(ContentService.MimeType.JSON); }
-
Click the Deploy button and select New Deployment from the script.
-
For deployment type select Web App
-
Change
Who has access to the app:
to "Anyone" (⚠️ This means anyone with the URL can perform a POST request to this script) -
Click Deploy then complete the authorization flow.
-
Use the generated web app URL in SMS Hooks as the webhook server URL.