Skip to main content

Inbound SMS API

By configuring a Webhook, you can receive real-time replies sent by end-users to your number, commonly referred to as MO (Mobile Originated) messages. This document details how to configure your Webhook URL, parse payload parameters, and provides code examples in various languages for receiving and processing to help you seamlessly implement two-way SMS interaction with your users.

1. Webhook Configuration & Details

Webhook Details
  • HTTP Method: GET
  • Webhook URL: The receiving endpoint you pre-configured in the PaaSoo console (provided and maintained by you).
  • Trigger Timing: When PaaSoo receives an MO (Mobile Originated) message from the Carrier, the system will immediately initiate a GET request to your Webhook URL, pushing the message details.
  • Retry Mechanism: If your server does not return an HTTP 200 OK correctly, PaaSoo will attempt to re-push the message after 5 minutes, 10 minutes, and 30 minutes.

2. Webhook Request Example

When an MO message is generated, the PaaSoo platform will call your Webhook URL in the following format:

GET https://USER_CALLBACK_URL?type=mo&messageid=015bd4-d6dfa7-58w&to=12025550124&from=12025550123&text=Hello+World

3. Request Parameters

In the received GET request, the URL Query contains the following parameters:

ParameterTypeDescriptionExample
typestringMessage type. For MO (Mobile Originated) messages, it is fixed as mo.mo
messageidstringMessage ID, the globally unique identifier for this inbound message.015bd4-d6dfa7-58w
tostringThe inbound number, usually the Virtual Numbers you applied for on the PaaSoo platform.12025550124
fromstringThe end user's mobile number.12025550123
textstringThe text content of the SMS.Hello World

4. Receiving and Processing Examples

The following examples demonstrate how to receive and process Webhook pushes on the server side. In actual applications, please modify the listening URL to the USER_CALLBACK_URL path configured on the PaaSoo platform, and add security checks (such as IP Whitelist, signature verification, etc.) and database storage logic according to your actual business needs.

The following code assumes your Webhook URL is: https://example.com/mo-callback.

import requests

# Your Webhook URL
url = "https://example.com/mo-callback"

# Simulated MO (Mobile Originated) query parameters
params = {
"type": "mo", # Message type, fixed as mo
"messageid": "015bd4-d6dfa7-58w", # Message ID (globally unique)
"to": "12025550124", # Virtual Number
"from": "12025550123", # End user's mobile number
"text": "Hello World" # SMS text content
}

try:
# Simulate the platform sending an HTTP GET request to your Webhook
response = requests.get(url, params=params)
response.raise_for_status()

print(f"Webhook simulation successful. Server response status code: {response.status_code}")
print(f"Response body: {response.text}")

except requests.exceptions.RequestException as e:
print(f"Simulation failed: {e}")

5. Response Requirements & Retry Policy

  • Success Response: After your server successfully receives and processes the request, it must return HTTP 200 OK or a similar 2xx success status code to confirm to PaaSoo that the callback was correctly received.
  • Retry Mechanism: If PaaSoo does not receive a valid 2xx response (e.g., server timeout or returns 4xx/5xx), the system will retry the push at intervals of 5 minutes, 10 minutes, and 30 minutes. If an HTTP 200 is still not received, the system will abandon further retries.

6. Security & Best Practices

  1. Data Transmission Security:
    • It is highly recommended that your Webhook URL uses the HTTPS protocol for encryption to ensure the security of the SMS content during transmission.
  2. Access Control:
    • It is recommended to configure an IP Whitelist on your server or gateway to only allow requests originating from PaaSoo's official server IP ranges, preventing malicious probing and forged requests.
  3. Idempotency Design:
    • Due to network jitter or the retry mechanism, your server may receive the same MO (Mobile Originated) message multiple times. Please make sure to use the messageid (Message ID) as a unique identifier to implement deduplication (idempotency) for database insertions or business logic.
Support

If you encounter any technical issues or have business inquiries during the API integration, please do not hesitate to contact our Support team at support@paasoo.com. We are always here to assist you.