shiftechafrica/smsales-php-sdk

Library for Smsales Api Triggers. Use this to send bulk sms.

v1.0.8 2023-04-26 08:32 UTC

This package is auto-updated.

Last update: 2024-05-27 09:17:38 UTC


README

68747470733a2f2f736d73616c65732e636f2e6b652f696d616765732f6c6f676f2e706e67

Always Delivering
68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f53484946544543482d4146524943412f736d73616c65732d7068702d73646b2e737667 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f53484946544543482d4146524943412f736d73616c65732d7068702d73646b2e737667 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f53484946544543482d4146524943412f736d73616c65732d7068702d73646b2e737667 68747470733a2f2f706f7365722e707567782e6f72672f73686966746563686166726963612f736d73616c65732d7068702d73646b2f762f737461626c65 68747470733a2f2f706f7365722e707567782e6f72672f73686966746563686166726963612f736d73616c65732d7068702d73646b2f646f776e6c6f616473

doc.png

Introduction

This library handles all the SMSALES API's.

Installing

The recommended way to install smsales-php-sdk is through Composer.

# Install package via composer
composer require shiftechafrica/smsales-php-sdk

Next, run the Composer command to install the latest stable version of shiftechafrica/smsales-php-sdk:

# Update package via composer
 composer update shiftechafrica/smsales-php-sdk --lock

After installing, the package will be auto discovered, But if need you may run:

# run for auto discovery <-- If the package is not detected automatically -->
composer dump-autoload

Then run this, to get the config/smsales.php for your own configurations:

# run this to get the configuration file at config/smsales.php <-- read through it -->
php artisan vendor:publish --provider="SMSALES\SMSALEServiceProvider"

A config/.php file will be created, follow the example below to define your own configurations.

# set your account secret key api token
SMSALES_API_TOKEN=check_on_api_profile

Usage

Follow the steps below on how to use the smsales-php-sdk:

How to use the Library

How to use the smsales-php-sdk to initiate different levels of api's

        use SMSALES\API\Trigger;
        
        /**
         * Fetch latest sent sms
         */
        (new Trigger())->index();
        
        /**
         * get sms account balance
         * @return mixed
         */
        (new Trigger())->accountSmsBalance());
        
        /**
         * get sms sender ids balance
         * @return mixed
         */
        (new Trigger())->senderIDSmsBalance());
  
        /**
         * initiate bulk sms
         * @return mixed
         */
        (new Trigger())->send([
            "api_sender" => "shiftech",// required check on your senderID's list for the API Sender
            "message" => "Hello Smsales.",// required
            "phone_numbers" => ["2547XXXXXXXX","2540XXXXXXXX","2547XXXXXXXX"],// required
            "scheduled_at" => "Y-m-d H:i:s", // optional
            "callback_url"=> "https://yourdomain/report"// optional this should be a POST request
        ]);

API Responses

These are the responses.

Successful bulk sms

{
    "data": {
        "message": "Accepted for dispatch..."
    }
}

Callback report for the bulk sms

{
  "sent":true,
  "sender":"SHIFTECH",
  "apiSender":"shiftech",
  "phoneNumbers":[
    "254XXXXXXXXX",
    "254XXXXXXXXX",
    "254XXXXXXXXX"
  ],
  "batch":"1CRVD1GEXE",
  "account":{
    "smsBalance":"663",
    "smsUsage":"24"
  }
}

Version Guidance

Version Status Packagist Namespace Repo
1.x Latest shiftechafrica/smsales-php-sdk SMSALES v1.0.8

Security Vulnerabilities

For any security vulnerabilities, please email to Shiftech Africa.

License

This package is open-source, licensed under the MIT License.