SimpleVoIP now supports programmatically sending SMS messages from any of the SMS-enabled numbers registered to your account. This can be used along with our SMS notification webhooks to embed SMS messaging in your own user portal or POS system.
Prerequisites
- You will need at least one DID (phone number) that has been enabled for 2-way SMS service. Ask your account manager if you are not sure whether your numbers are currently SMS-enabled or not. Numbers on each of your subaccounts will be accessible via the same API endpoint and with the same authentication key.
- We will also have to set up a brand and campaign for your business to maintain compliance with the recent 10DLC controls imposed by the major US cellular providers. This should only need to be done once, although we will have to add any new numbers to your campaign as they are ported in or added to your account if you want to use them for SMS.
API Description
All update requests are made via a POST request to https://public.simplevoip.us/sms/send
and should contain a JSON-encoded body as defined below.
Authentication
The API is secured by Bearer token authentication. You should supply the following header on your POST request, using the API key provided by SimpleVoIP as the {token_string} value:
Authorization: Bearer {token_string}
Request Body Definition
The request body must be a JSON object containing the following properties:
-
sender
(type:string
): The source DID of the message (i.e. the SimpleVoIP subscriber's number). We recommend formatting this using e.164 formatting.- Example:
"+18558998647"
- Example:
-
recipients
(type:list
ofstring
s): The destination DIDs* of the message. We recommend formatting these numbers using e.164 formatting.- *Note: We currently only support 1 recipient per message, but it still must be formatted as an array for future compatibility.
- Example:
["+18558998647"]
-
body_text
(type:string
): The body of the SMS message.- Example:
"Hello, SMS-using world!"
- Example:
cURL Request Example:
curl -X POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer YOUR_API_KEY" \
--data '{
"sender": "+13125552368",
"recipients": ["+15558675309"],
"body_text": "Hello, SMS-using world!"
}' \
https://public.simplevoip.us/sms/send
Response:
{
"status": "success",
"msg_id": "12345-new-message-uuid"
}
Error response example:
{
"status": "failed",
"error": "Invalid sender or recipient number provided."
}
FAQs:
Can we send SMS to multiple recipients?
Not yet! But you still need to format the recipients
property as a list/array so that we can add that feature without making breaking API changes.