image

Forward SMS To A URL or API

Post Incoming SMS to a URL

post sms to a url or api



Auto Forward SMS PRO For Android can automatically forward/POST incoming text messages to a URL. For example, an API or a website link you've setup to receive and process incoming SMS.


There are 3 options you can use:

  • form-data
  • x-www-form-urlencoded
  • raw JSON

More details on each option below.


In order to setup a Forward/POST to URL, it is highly recommended you have the skills to set this up, or consult a developer. We’ll assist you where possible.


You can also tell the app to RETRY failed posts. If this option is toggled ON, app will retry every 15 minutes for a maximum of 24 hours. Plus you can request an email warning if POST fails.


Both the FWD ALL INCOMING SMS and CREATE TASK screens have this function.


Post Body example: {"phoneNumber":"222333444","sms":"Hello John - From 222333444"}



POST to URL Features & Functions

form-data

For multipart/form-data, the body is separated by a particular string boundary.


Example of a form using form-data content type:


HttpResponse response = Unirest.post("http://ptsv2.com/t/1x8ve-1542263550/post")
.header("content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW")
.header("cache-control", "no-cache")
.header("Postman-Token", "5d3c2fb9-7113-4e2a-b9ad-319ce66ef60a")
.body("------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"phoneNumber\"\r\n\r\nxxxxxx\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"sms\"\r\n\r\nzzzzzzz\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--")
.asString();

x-www-form-urlencoded

For x-www-form-urlencoded, the body of the HTTP message is sent as a long query string, contains name-value pair separated by "&" character.


An example of a simple form using the application/x-www-form-urlencoded content type:


header("Content-Type", "application/x-www-form-urlencoded")
.header("cache-control", "no-cache")
.header("Postman-Token", "0146a6af-b9da-429d-b2e2-68e70137fbbc")
.body("phoneNumber=zzzzzzz&sms=xxxxxxx")
.asString();


Useful info: Stack Overflow has info about the above functions and what they mean. Click here to view Stack Overflow page
post sms to url

raw JSON

When you select "Raw", the body will be pre-generated as below


"data":{
"phoneNumber":
"[PHONE_NUMBER]",
"sms":"[SMS_CONTENT]",
"sim":"[SIM_ID]"
"dateReceived":"["DATE_TIME]"
  }
}

You can include any key-value you want. As long as Auto Forward SMS finds the [PHONE_NUMBER], it will be replaced by the sender's phone number.


Similar to that:
[SMS_CONTENT] will be replaced with the SMS message content


[SIM_ID] will be replaced by SIM 1 or SIM 2 (if Dual SIM phone)


[DATE_TIME] with date and time the SMS was received.



Any value you don't need, simply tap on it (puts raw JSON in edit mode), and remove that value using backspace or delete on your phone keyboard, then SAVE.

TIP: A handy endpoint site to pre-test your POST data & ensure the app is working is: www.webhook.site

ENDPOINT CODE: We have sample PHP & Python endpoint code here: github.com/autoforwardsms/afsms

post sms message to a url or api

Extra Settings

FWD TO URL EXTRA SETTINGS & FWD TO URL REPORTS

Escape Special Characters: Toggle this ON if you use any characters reserved in JSON that must be properly escaped to be used in strings.


Your SIM information: This value will be POSTED as [SIM_ID].


FWD TO URL REPORTS: If your POSTS fail, you can select and email yourself or others reports for troubleshooting.




We want to further develop the POST to URL feature, so if you have any special requests, require assistance, or need a different function, please get in touch.

extra settings escape JSON characters

HELP

As an Auto Forward SMS customer, we offer you prompt, professional support. You can access HELP right from the app.



Tap the app's HELP screen to view your options. By using EMAIL US FOR HELP, you can send us a LOGFILE so we can troubleshoot for you. This logfile contains 2 weeks of events. Don't worry, any personal data is redacted with ****


in app HELP

Start your 7-day free trial of Auto Forward SMS now. To install on your Android phone, tap button below:


install auto forward sms app


After install you'll be asked to input your mobile number to receive a verification code via SMS, then your email to register the app to you. Your details are ever disclosed to anybody.


Didn't get the code? Please email us.


We use the app ourselves, and you should find it easy to use. But if you have any issues or questions, we offer you prompt free support.


Need help?

Please email us: support@autoforwardsms.com


We're based in the USA so please allow for timezone delays. Thank you.