Git Product home page Git Product logo

android-sms-ntfy's Introduction

SMS Hooks

Inactivity Notice

Due to time constrains, I am not able to work on SMS Hooks at the time being. Another alternative app is Android Incoming SMS Gateway Webhook.

About

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, // UTC 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 row in the spreadsheet.

  1. Create a spreadsheet in Google Sheets.

  2. Create a sheet-bound Google Apps Script by selecting Extensions > Apps Script from the spreadsheet.

  3. This should open the newly created Google Apps Script project. Inside the Code.gs file delete any existing code.

  4. 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);
    }
  5. Click the Deploy button and select New Deployment from the script.

  6. For deployment type select Web App

  7. Change Who has access to the app: to "Anyone"

    Warning: This means anyone with the URL can perform a POST request to this script

  8. Click Deploy then complete the authorization flow.

  9. Use the generated web app URL in SMS Hooks as the webhook server URL.

Screenshots

App settings

Credits

  • Katerina Limpitsouni's unDraw for the vector illustrations

android-sms-ntfy's People

Contributors

sa3dany avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.