msgowl-laravel maintained by theloopcraft
Introduction
msgowl-laravel is a laravel package developed by Loopcraft for MsgOwl
Installation & Setup
Install the latest version of the package using composer:
composer require theloopcraft/msgowl-laravel
Publish Configuration:
php artisan vendor:publish --provider "theloopcraft\msgowl\MsgOwlServiceProvider"
.env File Changes:
Add the following variables to .env file: MSG_OWL_REQUESTS MSG_OWL_SECONDS MSG_OWL_REST_KEY MSG_OWL_OTP_KEY MSG_OWL_NOTIFICATION_ACTIVE MSG_OWL_SMS_NUMBER MSG_OWL_SMS_MSG
Explanation of env values: Number of requests per second MSG_OWL_REQUESTS="200"
Number seconds to keep the given requests contained MSG_OWL_SECONDS="60"
You will get a rest key when you signup at msgowl MSG_OWL_REST_KEY="your-msgowl-rest-key"
You will get an otp key when you signup at msgowl MSG_OWL_OTP_KEY="your-msgowl-otp-key"
Keep this value true if you want to receive notification when balance is low MSG_OWL_NOTIFICATION_ACTIVE="false"
The contact number (with country code) to recieve balance low notifications MSG_OWL_SMS_NUMBER="960XXXXXXX"
The message to be sent when balance is running low MSG_OWL_SMS_MSG="Your MsgOwl balance is getting low"
Methods
Send Message sendMessage(string $contact_numbers, string $message, ?string $sender_id = null) $contact_numbers : Comma separated numbers "9601234567, 9602345678" $message : text message that needs to be sent to the recipients $sender_id : (optional) If sender id is different from default sender id. Sender id provided on the MsgOwl dashboard.
sendOtp(string $contact_number, ?string $code = null , $code_length = null, $timestamp = null ) $contact_number : string number "9601234567" $code : (optional) OTP code. If not provided MsgOwl will generate an OTP code for you. $code_length : (optional) default 6 $timestamp: (optional) timestamp used to generate code, format: 2020-03-03T08:32:50.231979481Z
Usage Example
use theloopcraft\msgowl\MsgOwl;
//Initialize MsgOwl Service $msgOwlService = new MsgOwl('YourMsgOwlUsername');
// Send an SMS $msgOwlService->sendMessage('9601234567', 'This is your msg');
// if otp is generated locally $msgOwlService->sendOtp('9601234567', '123456');
//if otp is generated by msgowl $msgOwlService->sendOtp('9601234567', '123456');