Skip to main content

Forwarding Messages

Forwarding incoming messages to a different number is not much different than whan we have seen for receiving your first SMS. In fact, we are going to apply just a minor variation to the XML bin used, so make sure to follow that guide first.

Writing a message forwarding bin

Let's write an XML bin which will forward messages. We will host this one on SignalWire so that you don't need to set up any infrastructure of your own.

You can create and manage bins from the LaML section of your Dashboard under the Bins tab.

A screenshot of the LaML page within the SignalWire Project called 'Dan's Space'. The Bins tab is circled in red.
XML bins tab of the LaML section

Create a new bin, and use the following lines as content:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message to="+1xxxxxxxxxx">
You received a message from: {{From}} to SignalWire number: {{To}}.
The message is: "{{Body}}"
</Message>
</Response>

We used the <Message> verb to send the inbound message to a different number. Make sure to set the to parameter to the number you would like to forward to.

In the body of the message we used {{From}}, {{To}}, and {{Body}}. These placeholders will get replaced with actual values at runtime. To learn more about the XML syntax, refer to our Compatibility XML documentation.

Configuring your number

The last step is connecting a number to the bin. If you don't have a phone number yet, make sure to buy one. You will need at least one number to receive messages.

Refer to the same section in Receiving your first SMS for in-depth instructions on how to assign the XML bin to one of your phone numbers.

Ensuring message delivery

If you are sending messages to the US from a 10DLC number — including forwarding messages — you must register your traffic with the Campaign Registry. Otherwise, the carriers will not deliver your messages. Please see Campaign Registry - Everything You Need To Know for more information.

Wrap up

We have seen an example of forwarding incoming messages to a different number using XML bins.

If you would like to forward incoming texts to an email address instead of another phone number, please check out our Forwarding Texts to Email guides in Python or Node.js.