Skip to main content
When someone sends an SMS to your mycpaas number, mycpaas makes an HTTP POST request to the webhook URL you have configured. Your server receives the message details, processes them however your application needs, and returns a LaML XML response to control what happens next — such as sending an automatic reply.

How inbound delivery works

  1. A user sends an SMS to your mycpaas phone number.
  2. mycpaas sends an HTTP POST to your configured webhook URL with the message details as form-encoded body parameters.
  3. Your server responds with LaML XML. mycpaas executes the instructions in the XML (e.g. sends a reply message).
You configure your webhook URL in the Dashboard. Navigate to your phone number’s settings and enter the URL under Messaging webhook.

Inbound webhook payload

mycpaas sends the following parameters in the POST body:
From
string
The phone number that sent the message, in E.164 format (e.g. +491234567890).
To
string
Your mycpaas phone number that received the message, in E.164 format (e.g. +491098765432).
Body
string
The text content of the inbound message.
MessageSid
string
A unique identifier for the inbound message, prefixed with SM.

Replying with LaML XML

To send a reply, return a LaML XML document in your HTTP response. Set the Content-Type header to application/xml (or text/xml). mycpaas reads the XML and executes the instructions before continuing.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Message>Thanks for your message — we'll be in touch shortly.</Message>
</Response>
If your webhook returns an empty body or a non-XML response, mycpaas takes no further action for that message.

Webhook handler example

The following Node.js example uses Express to receive an inbound SMS and send back an automatic reply:
import express from 'express';

const app = express();
app.use(express.urlencoded({ extended: false }));

app.post('/sms/inbound', (req, res) => {
  const { From, To, Body, MessageSid } = req.body;

  console.log(`Message ${MessageSid} from ${From}: ${Body}`);

  const reply = `
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Message>Hi! We received your message: "${Body}"</Message>
</Response>
  `.trim();

  res.set('Content-Type', 'application/xml');
  res.send(reply);
});

app.listen(3000, () => console.log('Webhook server running on port 3000'));
Your endpoint must be reachable from the internet. During local development, use a tunneling tool such as ngrok to expose your server to mycpaas.
ngrok http 3000
Copy the HTTPS URL ngrok provides (e.g. https://abc123.ngrok.io) and enter it as your webhook URL in the Dashboard.

Content-Type requirement

Your response must include the Content-Type: application/xml header. Without it, mycpaas may not parse the LaML correctly and will not execute the instructions in your response.
Accepted valuesNotes
application/xmlRecommended
text/xmlAlso accepted