Coder Social home page Coder Social logo

d07h4ck / android_income_sms_gateway_webhook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bogkonstantin/android_income_sms_gateway_webhook

0.0 0.0 0.0 1.64 MB

Simple Android incoming SMS to URL forwarder

License: MIT License

Java 100.00%

android_income_sms_gateway_webhook's Introduction

Incoming SMS to URL forwarder

Try my new Android App - Easy Expense Tracker

How to use

Set up App Permissions for you phone after installation. For example, enable "Autostart" if needed and "Display pop-up windows while running in the background" from Xiaomi devices.

Set sender phone number or name and URL. It should match the number or name you see in the SMS messenger app. If you want to send any SMS to URL, use * (asterisk symbol) as a name.

Every incoming SMS will be sent immediately to the provided URL. If the response code is not 2XX or the request ended with a connection error, the app will try to send again up to 10 times. Minimum first retry will be after 10 seconds, later wait time will increase exponentially. If the phone is not connected to the internet, the app will wait for the connection before the next attempt.

If at least one Forwarding config is created and all needed permissions granted - you should see F icon in the status bar, means the app is listening for the SMS.

Request info

HTTP method: POST
Content-type: application/json; charset=utf-8

Sample payload:

{
     "from": "%from%",
     "text": "%text%",
     "sentStamp": "%sentStamp%",
     "receivedStamp": "%receivedStamp%",
     "sim": "%sim%"
}

Available placeholders: %from% %text% %sentStamp% %receivedStamp% %sim%

Request example

Use this curl sample request to prepare your backend code

curl -X 'POST' 'https://yourwebsite.com/path' \
     -H 'content-type: application/json; charset=utf-8' \
     -d $'{"from":"1234567890","text":"Test"}'

Send SMS to the Telegram

  1. Create Telegram bot and channel to receive messages. There is short tutorial how to do that.
  2. Add new forwarding configuration in the app using this parameters:
    1. Any sender you need, * - on the screenshot
    2. Webhook URL - https://api.telegram.org/bot/sendMessage?chat_id=<channel_id> - change URL using your token and channel id
    3. Use this payload as a sample {"text":"sms from %from% with text: \"%text%\" sent at %sentStamp%"}
    4. Save configuration

Incoming SMS Webhook Gateway screenshot Telegram example

Process Payload in PHP scripts

Since $_POST is an array from the url-econded payload, you need to get the raw payload. To do so use file_get_contents:

$payload = file_get_contents('php://input');
$decoded = json_decode($payload, true);

Screenshots

Incoming SMS Webhook Gateway screenshot 1 Incoming SMS Webhook Gateway screenshot 2 Incoming SMS Webhook Gateway screenshot 3

Download apk

Download apk from release page

Or download it from F-Droid

Get it on F-Droid

android_income_sms_gateway_webhook's People

Contributors

bogkonstantin avatar izzysoft avatar poussinou avatar scottmconway 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.