Send an SMS via API (ReST)

Follow the steps below to send SMS and MMS messages.

  1. Using the SMS examples below, write a curl command that will submit an outbound message request. Include your profile secret in the X-Profile-Secret request header, and add the source (from) and destination (to) phone numbers, and the message’s content (body) into the payload. Optionally, your payload may include a delivery_status_webhook_url or delivery_status_failover_url (or both).
Note: Don’t forget to update YOUR_MESSAGING_PROFILE_SECRET in the below commands.

For more information check out this article:
https://help.oneuc.com/knowledge-base/generating-a-profile-secret-sender_id/

Send SMS

curl -X POST "https://sms.api.oneuc.com/messages" \
  -H "Content-Type: application/json" \
  -H "X-Profile-Secret: YOUR_MESSAGING_PROFILE_SECRET" \
  -d '{
    "from": "+13125550001",
    "to": "+13129450002",
    "body": "Hello!",
    "delivery_status_webhook_url": "https://example.com/campaign/7214"
}'

Example Response

{
  "sms_id": "834f3d53-8a3c-4aa0-a733-7f2d682a72df",
  "gw_sms_id": "",
  "user_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
  "profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
  "status": "queued",
  "delivery_status": "",
  "msg": {
    "src": "+13125550001",
    "dst": "+13129450002",
    "body": "Hello, world!",
    "is_mms": false
  },
  "delivery_status_webhook_url": "https://example.com/campaign/7214",
}

Notes:

Make sure you’re using the full +E.164 formatted number for your to and from numbers. In the US and Canada, this typically means adding +1 to the beginning of your 10-digit phone number.

This example includes a delivery status webhook URL. This field is optional, but useful if you want real-time updates about the status of the message.

Updated on March 18, 2022

Was this article helpful?

Related Articles