AutoForward SMS

How to forward text messages to an URL/API endpoint?

API integration article header image

Did you ever want to forward a text message (SMS) to some other place on the web? In that case, the URL/API forwarding is just what you need.

In this article, we are going to cover an advanced use-case of forwarding incoming text messages to another web server. Please familiarize yourself with the app’s setup as well as the more common e-mail forwarding first.

What is URL/API forwarding?

URL or API forwarding is when you forward an incoming text message (SMS) to another server on the web. The recipient can be any web address as long as the receiving server understands the messages it is being sent.

This type of forwarding is useful if you are implementing a custom piece of software that can ingest text messages from Android phones.

Our friends over at webhook.site have created a tool for you to inspect how forwarded text messages (SMS) look like.

PRO TIP

How to configure URL/API forwarding?

URL/API forwarding differs from email forwarding only in the sense that the target section of the screen needs slightly different information.

Let’s quickly talk about the mandatory fields

  • HTTP Method: Determines what kind of request is sent to the URL below. The most common options are GET, POST, and DELETE. Head over to to tutorialspoint.com for more information.
  • URL: Represents the destination where you want to send your information to. The value entered must be a valid & existing URL endpoint.
  • JSON Body: Allows you to format the body of your message and must be in JSON format. A full list of replacement tokens that are available at the end of the article. The standard JSON body that we’re normally using is: {“sender”: “{sender}”,”message”: “{body}”}

The JSON body field needs to be a valid JSON string. Should you need help validating your JSON input, please refer to jsonlint.com

PRO TIP

If all your settings look OK, tap Apply to save.

What if my endpoint is unavailable?

Our software will attempt to deliver any messages for up to 24 hours after they have initially been created. The delivery mechanism uses an exponential backoff strategy with increasing timeouts between retries.

What replacement tokens are there?

When building the JSON body for the URL/API forwarding, you can use certain placeholders that will be replaced with actual values from the message when it arrives. This gives you the flexibility to customize how the transmitted message looks like.

Our servers will replace the following placeholders before forwarding.

  • {sender} is replaced with the sender’s phone number (or, if available, the sending contact’s name)
  • {name} is replaced with the sender’s contact name (if available).
  • {body} is replaced with the content of the incoming message.
  • {date_time} is replaced with the UTC timestamp the message was received on the sender’s phone.

Photo by Startup Stock Photos from Pexels

Comments are closed.