How to Send SMS
How to Send Customized SMS

How to Send Customized SMS

You can send Customized SMSes to one or many recipients by making a HTTP POST request with the following:

Endpoint

https://api.smsleopard.com/v1/sms/send

Authorization

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Sample Request Body

{
	"source": "sms_test",
	"multi": true,
	"message": "Dear {name}, Hello from the smsleopard api",
	"destination": [
		{
			"number": "+254700000001",
			"message": "Dear Mary, Hello from the smsleopard api"
		},
		{
			"number": "+254700000002",
			"message": "Dear Nick, Hello from the smsleopard api"
		},
		{
			"number": "+254700000003",
			"message": "Dear Orz, Hello from the smsleopard api"
		}
	],
	"status_url": "",
	"status_secret": ""
}

Code Examples

curl -i -u ACCOUNT_ID:ACCOUNT_SECRET -H "Content-Type: application/json" -X POST https://api.smsleopard.com/v1/sms/send -d '{"source": "SMSLeopard", "multi": true, "message": "Hello {name}", "destination": [{"number": "+254710000001", "message": "Hello Bri"}, {"number": "+254710000002", "message": "Hello Joan"}], "status_url": "https://your-status.url", "status_secret": "supersecret"}'

Payload

  • Message - The message template to be customized for each recipient.
  • Destination - An array of recipient objects with the number you intend to send the message to.
  • Number - The specific recipient number you intend to send to.
  • Destination → Message - The customized message to send to the recipient.
  • Source - Sender id for the message.
  • Multi - Allow sending specific messages to multiple recipients.
  • Status_url - The URL to receive delivery reports on (optional).
Example of a Successful Response

Status code: 201

{
	"success": true,
	"message": "Sent to 1/1. Cost KES 0.90",
	"recipients": [
		{
			"id": "eb4647b2-2695-4aba-958e-0b39d965f6d0",
			"cost": 0.9,
			"number": "+254700000001",
			"status": "queued"
		}
	]
}