Download the PHP package advanta_africa/sms_api without Composer
On this page you can find all versions of the php package advanta_africa/sms_api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download advanta_africa/sms_api
More information about advanta_africa/sms_api
Files in advanta_africa/sms_api
Package sms_api
Short Description A PHP package for sending SMS using Advanta Africa APIs
License MIT
Informations about the package sms_api
Advanta Africa SMS API Package
Overview
The Advanta Africa SMS API package provides a simple interface for sending SMS, checking SMS balance and retrieving delivery reports using the Advanta Africa SMS APIs. This package allows you to easily integrate SMS functionalities into your PHP applications.
Table of Contents
- Installation
- Usage
- Configuration
- Sending SMS
- Sending OTP
- Sending OTP
- Sending Bulk SMS
- Getting Balance
- Getting Delivery Reports
- Endpoints
- Author
- License
Installation
You can install this package via Composer. Run the following command:
Usage
Configuration
To use the package, you need to provide the API credentials and the URL for the specific endpoint you want to interact with. You can pass the URL, API key, partner ID and sender ID directly when creating an instance of the package. These crednetials are accessible in your Advanta Africa SMS account. You can contact them for account creation
Sending SMS
To send a single SMS, you can use the sendSingleSmsPost
method for POST requests or sendSingleSmsGet
for GET requests. Both methods accept mobile numbers and a message. Optionally, you can pass timeToSend to schedule messages (or pass null if not being scheduled) and a hashed key = true when sending to hashed numbers.
POST Example
You can pass a single number or a comma separated set of numbers (Numbers can start with 07, 0 or 254):
GET Example
Send OTP Endpoint usage
When using the otp endpoint, you can use the same sendSingleSmsPost
method for POST requests or sendSingleSmsGet
for GET requests. This is the same endpoint for sending SMS to hashed numbers. You will need to pass hashed key and value true
. If not passed, it will be treated as a regular mobile number.
POST Example
To send an SMS to a hashed mobile number using OTP endpoint:
To send to a regular number using OTP endpoint:
GET Example
To send an SMS to a hashed mobile number using OTP endpoint:
To send to a regular number using OTP endpoint:
Sending Bulk SMS
To send multiple SMS messages in a single request, use the sendBulkSms
method. This method requires an array of SMS details and is only available via POST.
Example
Getting Balance
To check your SMS balance, you can use the getBalancePost
method for POST requests or getBalanceGet
for GET requests.
POST Example
GET Example
Getting Delivery Reports
To retrieve the delivery status of an SMS, you can use the getDeliveryStatusPost
for POST requests or getDeliveryStatusGet
for GET requests.
POST Example
GET Example
Endpoints
- Sending Single SMS to 1 or multiple recipients:
https://quicksms.advantasms.com/api/services/sendsms/
- Sending single SMS to 1 or multiple recipients via OTP route or sending to hashed mobile numbers:
https://quicksms.advantasms.com/api/services/sendotp
- Sending Bulk SMS:
https://quicksms.advantasms.com/api/services/sendbulk/
- Getting Balance:
https://quicksms.advantasms.com/api/services/getbalance/
- Getting Delivery Report:
https://quicksms.advantasms.com/api/services/getdlr/
Important Notes
- For the Send SMS and Send OTP endpoints, both use the same methods (
sendSingleSmsPost
andsendSingleSmsGet
), but they have different URLs and may require a hashed key for SMS requests sent to a hashed mobile number. - When scheduling messages, pass the time as a string that can be converted to a Unix timestamp. If not needed, simply omit it.
- Ensure that the
partnerId
is always numeric. - Mobile numbers can start with 254,07 or 0 for new prefixes
- When sending to hashed numbers, make sure the number before being hashed starts with 254xxxxxxxxxx
Author
Harold Kerry Omondi Email: [email protected]
License
This package is licensed under the MIT License.