Skip to main content

Receiving Your First SMS

To send your first SMS, you needed a phone number, API credentials, and a REST API call.

Receiving messages works a bit differently: when using the cXML API, you need to prepare an XML file with instructions on what to do after a message is received on a given phone number.

Receiving text messages from users using cXML applications.

cXML Applications

Let's write our first cXML script. We will host this one on SignalWire (you can use your own server if you want, which even allows you to generate scripts dynamically).

Navigate to the "Resources" tab from the sidebar and create a new Resource. There, select the resource type of "Script", and pick "cXML script".

There, you can paste the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message>Hello from SignalWire!</Message>
</Response>

The script will reply with a fixed message to any incoming SMS. Find the full technical reference in the Compatibility XML section.

Copy the Request URL of the script you just created, then read the next section to configure a number to handle messages using that bin.

Does your Dashboard look different?

If your account was created prior to January 2025, your Dashboard may be on the Legacy UI.

Identify your Dashboard and select between Legacy and New UIs using the tabs below.

Resources that were previously accessible in the sidebar of the legacy UI are now located in the unified Resource menu.

Navigate to the "LaML/cXML" section of your Dashboard and create a new cXML bin with the content above.

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.

Navigate to the "Phone Numbers" section of your Dashboard and open the settings for the number you want to configure. There, assign the cXML script you just created to handle messages.

Does your Dashboard look different?

If your account was created prior to January 2025, your Dashboard may be on the Legacy UI.

Identify your Dashboard and select between Legacy and New UIs using the tabs below.

Resources that were previously accessible in the sidebar of the legacy UI are now located in the unified Resource menu.

Open the settings for the number you want to configure. Under "Messaging Settings", choose to handle messages using "LaML Webhooks". In the dropdown, select the cXML script you just created.

Try sending a message to the configured phone number: after a few seconds you'll receive an automated reply.

Ensuring message delivery

If you are sending messages to the US from a 10DLC number, 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 shown how to receive a text message and perform follow-up actions.

This example used the Compatibility API, and in particular cXML bins, to receive a message. For more advanced, real-time applications, you'll want to check out our Realtime SDK.