MessageGears notification drivers for Laravel.
actengage/laravel-message-gears is a Laravel package for messagegears notification drivers for laravel..
It currently has 0 GitHub stars and 2.923 downloads on Packagist (latest version v4.0.0).
Install it with composer require actengage/laravel-message-gears.
Discover more Laravel packages by actengage
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel package for the MessageGears API. Provides fluent Cloud and Accelerator API clients, a notification channel, and a Symfony Mailer transport.
composer require actengage/laravel-message-gears
The service provider is auto-discovered.
Add your MessageGears credentials to config/services.php:
// config/services.php
return [
'messagegears' => [
'cloud' => [
'accountId' => env('MESSAGEGEARS_ACCOUNT_ID'),
'apiKey' => env('MESSAGEGEARS_API_KEY'),
],
'accelerator' => [
'accountId' => env('MESSAGEGEARS_ACCELERATOR_ACCOUNT_ID'),
'apiKey' => env('MESSAGEGEARS_ACCELERATOR_API_KEY'),
],
'campaign_id' => env('MESSAGEGEARS_CAMPAIGN_ID'),
],
];
use Actengage\MessageGears\Notifications\TransactionalEmail;
$notification = TransactionalEmail::make()
->campaignId('CAMPAIGN_ID')
->context([
'SubjectLine' => 'Welcome!',
'HtmlContent' => '<h1>Hello</h1>',
'TextContent' => 'Hello',
]);
$user->notify($notification);
The Cloud facade authenticates automatically and prepends the API version to URIs.
use Actengage\MessageGears\Facades\Cloud;
// Authenticated POST request
$response = Cloud::authenticate()->post('campaign/transactional/CAMPAIGN_ID', [
'json' => [
'accountId' => 'ACCOUNT_ID',
'recipient' => [
'data' => ['EmailAddress' => '[email protected]'],
'format' => 'JSON',
],
],
]);
use Actengage\MessageGears\Facades\Accelerator;
$response = Accelerator::post('endpoint', [
'json' => ['key' => 'value'],
]);
You can use MessageGears as a Laravel mail transport. Add the mailer to config/mail.php:
// config/mail.php
'mailers' => [
'messagegears' => [
'transport' => 'messagegears',
'campaign_id' => env('MESSAGEGEARS_CAMPAIGN_ID'),
],
],
Then send mail as usual:
Mail::mailer('messagegears')->to('[email protected]')->send(new WelcomeEmail());
The TransactionalEmail notification supports a full set of fluent options:
TransactionalEmail::make()
->campaignId('CAMPAIGN_ID')
->campaignVersion('v2')
->context(['SubjectLine' => 'Hello'])
->category('marketing')
->correlationId('corr-123')
->latestSendTime('2030-01-01 12:00:00')
->notificationEmailAddress('[email protected]')
->fromAddress('[email protected]')
->fromName('My App')
->replyToAddress('[email protected]');
composer test # Run Pest tests
composer lint # Run Pint
composer analyse # Run PHPStan
composer rector # Run Rector (dry-run)
MIT