Sending Messages

Up to 100 SMS messages may be batched into a single request, or, a single message to one or more of your Groups.

Send Options

While each of these methods of sending has its own distinct requests/requisites, they share common functionality in the form of Send Options. These options can be used to tailor the settings for messages in a request.

Bulk Message Request

The following is an example request to use the bulk messages resource:

POST /bulkmessages HTTP/1.1
HOST: rest.smsportal.com/v1
Content-Type: application/json
Authorization: Bearer [Your Authorization Token]
Accept: application/json
{
  "Messages": [
    {
      "Content": "Hello John. Our new API is available. https://docs.smsportal.com/docs/rest to learn more",
      "Destination": "27830000000"
    }
  ]
}

Group Message Request

The following is an example request to use the group messages resource:

POST /groupmessages HTTP/1.1
HOST: rest.smsportal.com/v1
Content-Type: application/json
Authorization: Bearer [Your Authorization Token]
Accept: application/json
{
  "Message": "Hello John. Our new API is available. https://docs.smsportal.com/docs/rest to learn more",
  "Groups": [
    "JohnGroupName"
  ]
}

Response:

HTTP/1.1 200 Accepted
Content-Type: application/json
{
  "Cost": 1,
  "RemainingBalance": 1500,
  "EventId": 12345678901,
  "Sample": "Hello John. Our new API is available. Go to https://docs.smsportal.com/docs/rest to learn more",
  "Messages": 1,
  "Parts": 1,
  "CostBreakDown": [
    {
      "Network": "Local",
      "Cost": 1,
      "Quantity": 1
    }
  ],
  "ErrorReport": {
    {
      "NoNetwork": 0,
      "Duplicates": 0,
      "OptedOuts": 0,
      "Faults": []
    }
    }
}

Test Mode Message Request

The following is an example request using test mode

POST /bulkmessages HTTP/1.1
HOST: rest.smsportal.com/v1
Content-Type: application/json
Authorization: Bearer [Your Authorization Token]
Accept: application/json
{
  "SendOptions": {
  	"TestMode": true
   },
   "Messages": [
    {
      "Content": "Hello John. Our new API is available. https://docs.smsportal.com/docs/rest to learn more",
      "Destination": "27830000000"
    }
  ]
}

Response:

HTTP/1.1 200 Accepted
Content-Type: application/json
{
  "Cost": 1,
  "RemainingBalance": 1500,
  "EventId": 0,
  "Sample": "Hello John. Our new API is available. Go to https://docs.smsportal.com/docs/rest to learn more",
  "Messages": 1,
  "Parts": 1,
  "CostBreakDown": [
    {
      "Network": "Local",
      "Cost": 1,
      "Quantity": 1
    }
  ],
  "ErrorReport": {
    {
      "NoNetwork": 0,
      "Duplicates": 0,
      "OptedOuts": 0,
      "Faults": []
    }
    }
}

📘

Test Mode

Please note that when Test Mode = true it will return the result but won’t send the data or deduct any credits. It also won’t appear in your sent report.

🚧

Post Paid Customers

Remaining Balance will always return a value of 1000000 on Post Paid accounts as no credit deduction occurs on this account type.

See the API Reference for more detailed information about:

  • Sendoptions
  • The bulkmessages resource
  • The groupmessages resource