1. Go to this page and download the library: Download bryceandy/laravel-beem library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Listeners;
use Bryceandy\Beem\Events\SmsDeliveryReportReceived;
class ProcessDeliveryReport
{
/**
* Handle the event.
*
* @param SmsDeliveryReportReceived $event
* @return \Illuminate\Http\JsonResponse
*/
public function handle(SmsDeliveryReportReceived $event)
{
$requestId = $event->request['request_id'];
$recipientId = $event->request['recipient_id'];
$mobileNumber = $event->request['dest_addr'];
$status = $event->request['status'];
//...
// After processing this report, send back an OK response to Beem
return response()->json([]);
}
}
Beem::smsSenderNames()->json();
$name = 'BRYCEANDY';
$sampleMessage = 'A sample message';
Beem::requestSmsSenderName($name, $sampleMessage);
// Template IDs can be obtained from the call above - Beem::smsTemplates()->json()
Beem::editSmsTemplate($templateId, $message, $smsTitle);
Beem::deleteSmsTemplate($templateId);
namespace App\Listeners;
use Bryceandy\Beem\Events\TwoWaySmsCallbackReceived;
use Bryceandy\Beem\Facades\Beem;
class ProcessOutboundSms
{
/**
* Handle the event.
*
* @param TwoWaySmsCallbackReceived $event
* @return void
*/
public function handle(TwoWaySmsCallbackReceived $event)
{
$from = $event->request['from'];
$to = $event->request['to'];
$text = $event->request['message']['text'];
//...
// After processing the received text, send a reply in your preferred way
$recipients = [
[
'recipient_id' => (string) 1,
'dest_addr' => $from
],
];
Beem::sms('Your order is being processed!', $recipients, $to);
}
}
use Bryceandy\Beem\Facades\Beem;
Beem::addressBooks()->json();
Beem::addressBooks($name)->json(); // Search by address book name
Beem::addAddressBook($name, $description);
// Obtain the address book IDs from - Beem::addressBooks();
Beem::editAddressBook($addressBookId, $name, $description);
Beem::deleteAddressBook($addressBookId);
// $q values are either 'fname', 'lname', or 'mob_no'
Beem::contacts($addressBookId, $q)->json();
$addressBookIds = ['abcd123', '456efg'];
$mobileNumber = '255784123456';
Beem::addContact($addressBookIds, $mobileNumber);
Beem::addContact($addressBookIds, $mobileNumber, $firstName, $lastName, $title, $gender, $mobileNumber2, $email, $country, $city, $area, $birthDate);
// $title can be Mr./Mrs./Ms.
// $gender can be male, female
// $birthDate can be a datetime value or Carbon instance
// Contact IDs can be obtained from the previous method - Beem::contacts()
Beem::editContact($contactId, $addressBookIds, $mobileNumber, $firstName);
Beem::editContact($contactId, $addressBookIds, $mobileNumber, $firstName, $lastName, $title, $gender, $mobileNumber2, $email, $country, $city, $area, $birthDate);
namespace App\Listeners;
use Bryceandy\Beem\Events\AirtimeCallbackReceived;
class ProcessAirtimeCallback
{
/**
* Handle the event.
*
* @param AirtimeCallbackReceived $event
* @return \Illuminate\Http\JsonResponse
*/
public function handle(AirtimeCallbackReceived $event)
{
$code = $event->request['code'];
$message = $event->request['message'];
//...
// After processing this data, send an OK response to Beem
return response()->json([]);
}
}