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_leopard",
	"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 API_KEY:API_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

  • source - A Sender ID of your smsleopard business account. If you have not yet been assigned any, use SMS_Leopard for testing purposes. Click here (opens in a new tab) to learn more.
  • multi - A boolean value (true/false) for whether to Allow sending specific messages to multiple recipients.
  • 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.
  • destination → number - The specific recipient number you intend to send to.
  • destination → message - The customized message to send to the recipient.
  • status_url - A callback URL to receive delivery reports on (optional).
  • status_secret - A secret value that you provide, only to be shared between you and us that you will use to verify updates sent from us (required when status_url is provided).
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"
		}
	]
}