### Install Facebook Poster Package
Source: https://laravel-notification-channels.com/facebook-poster
Install the package using Composer. No further setup is required for basic installation.
```bash
composer require laravel-notification-channels/facebook-poster
```
--------------------------------
### Install Web Push Package
Source: https://laravel-notification-channels.com/webpush
Install the package using Composer.
```bash
composer require laravel-notification-channels/webpush
```
--------------------------------
### Install Intercom Package
Source: https://laravel-notification-channels.com/intercom
Install the package using Composer.
```bash
composer require laravel-notification-channels/intercom
```
--------------------------------
### Install sipgate Notification Channel via Composer
Source: https://laravel-notification-channels.com/sipgate
Install the package via composer.
```bash
composer require laravel-notification-channels/sipgate
```
--------------------------------
### Install Plivo Package for Laravel
Source: https://laravel-notification-channels.com/plivo
Install the package using Composer.
```bash
composer require laravel-notification-channels/plivo
```
--------------------------------
### Install TurboSMS Package
Source: https://laravel-notification-channels.com/turbosms
Install the package using Composer.
```bash
composer require laravel-notification-channels/turbosms
```
--------------------------------
### Install Clickatell Package
Source: https://laravel-notification-channels.com/clickatell
Install the Clickatell notification channel package using Composer.
```bash
composer require laravel-notification-channels/clickatell
```
--------------------------------
### Install Laravel Evernote Channel
Source: https://laravel-notification-channels.com/evernote
Install the package via composer.
```bash
composer require laravel-notification-channels/evernote
```
--------------------------------
### Install Messagebird Package
Source: https://laravel-notification-channels.com/messagebird
Install the Messagebird notification channel package using Composer.
```bash
composer require laravel-notification-channels/messagebird
```
--------------------------------
### Setup Discord Bot via Artisan
Source: https://laravel-notification-channels.com/discord
Run the artisan command to complete the Discord bot setup process.
```bash
php artisan discord:setup
```
--------------------------------
### Install Rocket.Chat Laravel Notifications Channel
Source: https://laravel-notification-channels.com/rocket-chat
Install the package using Composer.
```bash
$ composer require laravel-notification-channels/rocket-chat
```
--------------------------------
### Install Jusibe Package
Source: https://laravel-notification-channels.com/jusibe
Install the Jusibe notification channel package using Composer.
```bash
composer require laravel-notification-channels/jusibe
```
--------------------------------
### Install Webex Notification Channel via Composer
Source: https://laravel-notification-channels.com/webex
Install the Webex notification channel package using Composer.
```bash
composer require laravel-notification-channels/webex
```
--------------------------------
### Install Laravel APN Package
Source: https://laravel-notification-channels.com/apn
Install this package with Composer.
```bash
composer require laravel-notification-channels/apn
```
--------------------------------
### Install AfricasTalking Channel via Composer
Source: https://laravel-notification-channels.com/africastalking
Install the package using Composer. The service provider is loaded automatically.
```bash
composer require laravel-notification-channels/africastalking
```
--------------------------------
### Install Laravel GCM Package
Source: https://laravel-notification-channels.com/gcm
Install the package using Composer.
```bash
composer require laravel-notification-channels/gcm
```
--------------------------------
### Install Laravel Facebook Notification Channel
Source: https://laravel-notification-channels.com/facebook
Install the package using Composer.
```bash
composer require laravel-notification-channels/facebook
```
--------------------------------
### Install Pushwoosh Package
Source: https://laravel-notification-channels.com/pushwoosh
Install the Pushwoosh notification channel package using Composer.
```bash
composer require laravel-notification-channels/pushwoosh
```
--------------------------------
### Install Gammu Notification Channel via Composer
Source: https://laravel-notification-channels.com/gammu
Install the Gammu notification channel package using Composer.
```bash
composer require laravel-notification-channels/gammu
```
--------------------------------
### Install InterFAX Notification Channel
Source: https://laravel-notification-channels.com/interfax
Install the package using Composer. The service provider is automatically registered.
```bash
composer require laravel-notification-channels/interfax
```
--------------------------------
### Install VWO Engage Package for Laravel
Source: https://laravel-notification-channels.com/vwo-engage
Install the package using Composer.
```bash
composer require laravel-notification-channels/vwo-engage
```
--------------------------------
### Install Laravel Telegram Notifications Channel
Source: https://laravel-notification-channels.com/telegram
Install the package using Composer.
```bash
composer require laravel-notification-channels/telegram
```
--------------------------------
### Install Laravel FCM Package
Source: https://laravel-notification-channels.com/fcm
Install the package using Composer.
```bash
composer require laravel-notification-channels/fcm
```
--------------------------------
### Install MailLift Package via Composer
Source: https://laravel-notification-channels.com/maillift
Install the laravel-notification-channels/maillift package using Composer.
```bash
composer require laravel-notification-channels/maillift
```
--------------------------------
### Install Sms Broadcast Package
Source: https://laravel-notification-channels.com/sms-broadcast
Install the package using Composer. This command adds the necessary files to your project.
```bash
composer require laravel-notification-channels/sms-broadcast
```
--------------------------------
### Example Configuration File Path
Source: https://laravel-notification-channels.com/twilio
The published configuration file for the Twilio notification channel is located at this path.
```text
/config/twilio-notification-channel.php
```
--------------------------------
### Install AllMySms Package for Laravel
Source: https://laravel-notification-channels.com/all-my-sms
Install the package using Composer. This command adds the necessary files to your project.
```bash
composer require laravel-notification-channels/all-my-sms
```
--------------------------------
### Install Laravel Twitter Notification Channel
Source: https://laravel-notification-channels.com/twitter
Install the package using Composer. The service provider is automatically loaded.
```bash
composer require laravel-notification-channels/twitter
```
--------------------------------
### Install Ionic Push Notifications Package
Source: https://laravel-notification-channels.com/ionic-push-notifications
Install the package via composer.
```bash
composer require laravel-notification-channels/ionic-push-notifications
```
--------------------------------
### Install Gitter Notification Channel
Source: https://laravel-notification-channels.com/gitter
Install the package using Composer. For older Laravel versions, specify a version constraint.
```bash
composer require laravel-notification-channels/gitter
```
```bash
composer require laravel-notification-channels/gitter -v 1.0.1
```
--------------------------------
### Install AWS SNS Package
Source: https://laravel-notification-channels.com/aws-sns
Install the package using Composer. Ensure to update dependencies.
```bash
composer require laravel-notification-channels/aws-sns --update-with-dependencies
```
--------------------------------
### Install Smspoh Package via Composer
Source: https://laravel-notification-channels.com/smspoh
Use Composer to install the Smspoh notification channel package.
```bash
composer require laravel-notification-channels/smspoh
```
--------------------------------
### Install Laravel Notification Channels for Workplace
Source: https://laravel-notification-channels.com/workplace
Install the package using Composer. This command adds the necessary dependencies to your Laravel project.
```bash
composer require laravel-notification-channels/workplace
```
--------------------------------
### Install Vodafone Notification Channel
Source: https://laravel-notification-channels.com/vodafone
Use Composer to install the package. This command adds the necessary files to your Laravel project.
```bash
composer require laravel-notification-channels/vodafone
```
--------------------------------
### Install SmscRu Package
Source: https://laravel-notification-channels.com/smsc-ru
Install the package using Composer. For Laravel 5.x, specify a version constraint.
```bash
composer require laravel-notification-channels/smsc-ru
```
```bash
composer require laravel-notification-channels/smsc-ru -v 2.0.3
```
--------------------------------
### Install SMS77 Laravel Package
Source: https://laravel-notification-channels.com/sms77
Install the SMS77 notification channel for Laravel using Composer.
```bash
composer require laravel-notification-channels/sms77
```
--------------------------------
### Install Trello Notification Channel Package
Source: https://laravel-notification-channels.com/trello
Install the package using Composer. This command adds the necessary dependencies to your Laravel project.
```bash
composer require laravel-notification-channels/trello
```
--------------------------------
### Install BearyChat Package via Composer
Source: https://laravel-notification-channels.com/bearychat
Install the package using Composer. This is the first step to integrating BearyChat notifications into your Laravel application.
```bash
$ composer require laravel-notification-channels/bearychat
```
--------------------------------
### Install Wunderlist Package via Composer
Source: https://laravel-notification-channels.com/wunderlist
Install the package using Composer. This command adds the Wunderlist notification channel to your Laravel project.
```bash
composer require laravel-notification-channels/wunderlist
```
--------------------------------
### Install Pusher Push Notifications Package
Source: https://laravel-notification-channels.com/pusher-push-notifications
Install the package using Composer. This command adds the necessary files to your Laravel project.
```bash
composer require laravel-notification-channels/pusher-push-notifications
```
--------------------------------
### Install Pushbullet Notification Channel via Composer
Source: https://laravel-notification-channels.com/pushbullet
Install the package using Composer. This command fetches the latest version of the Pushbullet notification channel for Laravel.
```bash
$ composer require laravel-notification-channels/pushbullet
```
--------------------------------
### Install CMSMS Package via Composer
Source: https://laravel-notification-channels.com/cmsms
Install the CMSMS notification channel package using Composer.
```bash
composer require laravel-notification-channels/cmsms
```
--------------------------------
### Install Pushover Channel via Composer
Source: https://laravel-notification-channels.com/pushover
Install the package using Composer. This command adds the Pushover notification channel to your Laravel project.
```bash
composer require laravel-notification-channels/pushover
```
--------------------------------
### Install PagerDuty Package for Laravel
Source: https://laravel-notification-channels.com/pagerduty
Install the package using Composer. This command adds the PagerDuty notification channel to your Laravel project.
```bash
composer require laravel-notification-channels/pagerduty
```
--------------------------------
### Install Smsapi Notification Channel via Composer
Source: https://laravel-notification-channels.com/smsapi
Use this command to install the Smsapi notification channel package for your Laravel project.
```bash
composer require laravel-notification-channels/smsapi
```
--------------------------------
### Install OneSignal Package for Laravel
Source: https://laravel-notification-channels.com/onesignal
Install the package using Composer. This command adds the OneSignal notification channel to your Laravel project.
```bash
$ composer require laravel-notification-channels/onesignal
```
--------------------------------
### Send Wunderlist Notification
Source: https://laravel-notification-channels.com/wunderlist
Use the `WunderlistChannel` and `WunderlistMessage` to send notifications. This example creates a starred task due tomorrow.
```php
use NotificationChannels\Wunderlist\WunderlistChannel;
use NotificationChannels\Wunderlist\WunderlistMessage;
use Illuminate\Notifications\Notification;
class ProjectCreated extends Notification
{
public function via($notifiable)
{
return [WunderlistChannel::class];
}
public function toWunderlist($notifiable)
{
return WunderlistMessage::create('Another channel bites the dust')
->starred()
->due('tomorrow');
}
}
```
--------------------------------
### Install Microsoft Teams Notification Channel
Source: https://laravel-notification-channels.com/microsoft-teams
Install the package using Composer. This command fetches the latest version of the Microsoft Teams notification channel for Laravel.
```bash
composer require laravel-notification-channels/microsoft-teams
```
--------------------------------
### Install Todoist Notification Channel via Composer
Source: https://laravel-notification-channels.com/todoist
Use this command to add the Todoist notification channel package to your Laravel project.
```bash
composer require laravel-notification-channels/todoist
```
--------------------------------
### Run Migrations
Source: https://laravel-notification-channels.com/webpush
Create the necessary database tables for push subscriptions by running the migrate command.
```bash
php artisan migrate
```
--------------------------------
### Install Authy Notification Channel via Composer
Source: https://laravel-notification-channels.com/authy
Use this command to install the Authy notification channel package for your Laravel project.
```bash
composer require laravel-notification-channels/authy
```
--------------------------------
### Install Webhook Notification Channel via Composer
Source: https://laravel-notification-channels.com/webhook
Install the package using Composer. This command adds the webhook notification channel to your Laravel project.
```bash
composer require laravel-notification-channels/webhook
```
--------------------------------
### Install Lob.com Notification Channel via Composer
Source: https://laravel-notification-channels.com/lob
Use this command to add the Lob.com notification channel package to your Laravel project.
```bash
composer require laravel-notification-channels/lob
```
--------------------------------
### Install Backport Package via Composer
Source: https://laravel-notification-channels.com/backport
Use this command to add the backport package to your Laravel 5.1 or 5.2 project.
```bash
composer require laravel-notification-channels/backport
```
--------------------------------
### Install 46Elks Notification Channel via Composer
Source: https://laravel-notification-channels.com/46elks
Use Composer to add the 46Elks notification channel package to your Laravel project.
```bash
composer require laravel-notification-channels/46elks
```
--------------------------------
### SmsBroadcastMessage Methods
Source: https://laravel-notification-channels.com/sms-broadcast
Examples of using available methods on `SmsBroadcastMessage` to customize your SMS. These include setting sender, content, delay, and reference.
```php
->content("Task #{$notifiable->id} is complete!")
```
```php
->sender('MySenderName')
```
```php
->delay(5)
```
```php
->reference('my-ref-code')
```
--------------------------------
### Configure sipgate Credentials in services.php
Source: https://laravel-notification-channels.com/sipgate
Extend config/services.php to read your sipgate credentials from your .env file.
```php
return [
...
'sipgate' => [
'username' => env('SIPGATE_USERNAME'),
'password' => env('SIPGATE_PASSWORD'),
'smsId' => env('SIPGATE_SMSID'),
'enabled' => env('SIPGATE_NOTIFICATIONS_ENABLED', true),
],
];
```
--------------------------------
### Run Tests
Source: https://laravel-notification-channels.com/fcm
Execute the project's test suite using Composer.
```bash
composer test
```
--------------------------------
### Run Tests
Source: https://laravel-notification-channels.com/clickatell
Execute the package's tests using the Composer command.
```bash
$ composer test
```
--------------------------------
### Configure Clickatell Service
Source: https://laravel-notification-channels.com/clickatell
Add your Clickatell credentials (user, password, and API ID) to the `config/services.php` file. These values should be retrieved from environment variables.
```php
// config/services.php
...
'clickatell' => [
'user' => env('CLICKATELL_USER'),
'pass' => env('CLICKATELL_PASS'),
'api_id' => env('CLICKATELL_API_ID'),
],
...
```
--------------------------------
### Publish Configuration
Source: https://laravel-notification-channels.com/webpush
Publish the package's configuration file to customize its behavior.
```bash
php artisan vendor:publish --provider="NotificationChannels\WebPush\WebPushServiceProvider" --tag="config"
```
--------------------------------
### Configure Gammu Service (Native Method)
Source: https://laravel-notification-channels.com/gammu
Configure the 'gammu' service settings in config/services.php for the native Gammu SMSD method.
```php
...
'gammu' => [
'method' => env('GAMMU_METHOD', 'db'),
'sender' => env('GAMMU_SENDER', null),
],
...
```
--------------------------------
### Create a KeyValue widget
Source: https://laravel-notification-channels.com/google-chat
Instantiates a KeyValue widget with optional top, content, and bottom labels. Use this for displaying segmented information in a table-like format.
```php
NotificationChannels\GoogleChat\Widgets\KeyValue::create(?string $topLabel, ?string $content, ?string $bottomLabel)
```
--------------------------------
### Configure Pushover Application Token
Source: https://laravel-notification-channels.com/pushover
Add your Pushover application token to the `config/services.php` file. This token is required for authenticating with the Pushover API.
```php
// config/services.php
'pushover' => [
'token' => 'YOUR_APPLICATION_TOKEN',
],
```
--------------------------------
### Add sipgate Credentials to .env file
Source: https://laravel-notification-channels.com/sipgate
Add your sipgate credentials to your .env file for configuration.
```dotenv
SIPGATE_NOTIFICATIONS_ENABLED=true
SIPGATE_USERNAME=mail@example.com
SIPGATE_PASSWORD=1234567890
SIPGATE_SMSID=s0
```
--------------------------------
### Install TouchSMS Notification Channel
Source: https://laravel-notification-channels.com/touch-sms
Install the package using Composer. This command adds the TouchSMS notification channel to your Laravel project.
```bash
composer require laravel-notification-channels/touch-sms
```
--------------------------------
### Run PHPUnit Tests
Source: https://laravel-notification-channels.com/rocket-chat
Execute the project's tests using PHPUnit. Ensure your environment is set up correctly before running this command.
```bash
$ vendor/bin/phpunit
```
--------------------------------
### Publish BearyChat Configuration
Source: https://laravel-notification-channels.com/bearychat
Publish the configuration file for the BearyChat package if you haven't already. This allows for custom settings.
```bash
$ php artisan vendor:publish --tag=bearychat
```
--------------------------------
### Configure Wunderlist Service
Source: https://laravel-notification-channels.com/wunderlist
Add your Wunderlist Client-ID to your `config/services.php` file. This step is required to authenticate with the Wunderlist API.
```php
// config/services.php
...
'wunderlist' => [
'key' => env('WUNDERLIST_API_KEY'),
],
...
```
--------------------------------
### Configure Image widget properties
Source: https://laravel-notification-channels.com/google-chat
Sets the URL for the image to be displayed and an optional URL to navigate to when the image is clicked.
```php
->imageUrl(string $url)
```
```php
->onClick(string $url)
```
--------------------------------
### Manual Service Provider Installation
Source: https://laravel-notification-channels.com/cmsms
Manually register the CMSMS service provider in Laravel 5.4 and below by adding it to the config/app.php file.
```php
// config/app.php
'providers' => [
...
NotificationChannels\Cmsms\CmsmsServiceProvider::class,
],
```
--------------------------------
### Configure Gammu Service (Redis Method)
Source: https://laravel-notification-channels.com/gammu
Configure the 'gammu' service settings in config/services.php to use Redis for Gammu API communication.
```php
...
'gammu' => [
'method' => env('GAMMU_METHOD', 'redis')
],
...
```
--------------------------------
### Configure MailLift Service Credentials
Source: https://laravel-notification-channels.com/maillift
Add your MailLift username and API key to the `config/services.php` file. Ensure the environment variables `MAILLIFT_USERNAME` and `MAILLIFT_API_KEY` are set.
```php
// config/services.php
...
'maillift' => [
'user' => env('MAILLIFT_USERNAME'),
'key' => env('MAILLIFT_API_KEY'),
],
...
```
--------------------------------
### Message Construction and Sending
Source: https://laravel-notification-channels.com/bearychat
Demonstrates how to use various message methods to set content, add attachments, and specify the recipient.
```APIDOC
## Message Methods
### `text(string $content)`
Sets the main content of the message.
### `notification(string $notification)`
Sets a specific notification text for the message.
### `markdown(bool $enable = true)`
Enables or disables markdown parsing for the message content.
### `add(string $text, string $title = null, string $images = null, string $color = null)`
Adds an attachment to the message with specified text, title, image URL, and color.
### `addImage(string $image, string $desc = null, string $title = null)`
Adds an image attachment to the message.
### `content(string $text, bool $markdown = false, string $notification = null)` or `content(string $text, string $attachment_text, string $attachment_title, string $attachment_images, string $attachment_color)`
Sets the message content and optionally attachment details.
### `remove(mixed $indices)`
Removes attachment(s) by their index or an array of indices.
### `channel(string $channel)`
Specifies the channel to send the message to.
### `user(string $user)`
Specifies the user to send the message to.
### `to(string $target)`
Specifies the target recipient (user or channel). User targets should be prefixed with '@', and channel targets can optionally be prefixed with '#'.
### Example Usage
```php
$message = (new Message)
->text('message content')
->notification('notification for this message')
->add('attachment content', 'attachment title', 'http://path/to/image', '#FF0000')
->to('@Boss');
```
### Example Payload
```json
{
"text": "message content",
"notification": "notification for this message",
"user": "Boss",
"attachments": [
{
"text": "attachment content",
"title": "attachment title",
"images": [
{
"url": "http://path/to/image"
}
],
"color": "#FF0000"
}
]
}
```
```
--------------------------------
### Send SMS Notification via GammuChannel
Source: https://laravel-notification-channels.com/gammu
Example of a Laravel Notification class using the GammuChannel to send SMS messages.
```php
namespace App\Notifications;
use NotificationChannels\Gammu\GammuChannel;
use NotificationChannels\Gammu\GammuMessage;
use Illuminate\Notifications\Notification;
class SendNotificationToSms extends Notification
{
public function via($notifiable)
{
return [GammuChannel::class];
}
public function toGammu($notifiable)
{
return (new GammuMessage())
->to($phoneNumber)
->content($content);
}
}
```
--------------------------------
### Send GCM Notification
Source: https://laravel-notification-channels.com/gcm
Example of a notification class that sends a GCM message. Ensure your notifiable model has a routeNotificationForGcm method.
```php
use NotificationChannels\Gcm\GcmChannel;
use NotificationChannels\Gcm\GcmMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [GcmChannel::class];
}
public function toGcm($notifiable)
{
return GcmMessage::create()
->title('Account approved')
->message("Your {$notifiable->service} account was approved!");
}
}
```
--------------------------------
### Publish Google Chat Configuration File
Source: https://laravel-notification-channels.com/google-chat
Run this Artisan command to publish the configuration file for the Google Chat notification channel, allowing you to set up webhooks.
```bash
$ php artisan vendor:publish --tag google-chat-config
```
--------------------------------
### Install Twilio Notifications Channel via Composer
Source: https://laravel-notification-channels.com/twilio
Use Composer to add the Twilio notification channel package to your Laravel project.
```bash
composer require laravel-notification-channels/twilio
```
--------------------------------
### Configure SMS77 API Key in services.php
Source: https://laravel-notification-channels.com/sms77
Add your SMS77 API key to the `services.php` configuration file. Ensure the `SMS77_API_KEY` environment variable is set.
```php
// config/services.php
...
'sms77' => [
'api_key' => env('SMS77_API_KEY')
],
...
```
--------------------------------
### Install Laravel HipChat Channel via Composer
Source: https://laravel-notification-channels.com/hipchat
Use Composer to add the HipChat notification channel package to your Laravel project.
```bash
composer require laravel-notification-channels/hipchat
```
--------------------------------
### Configure AfricasTalking Credentials in .env
Source: https://laravel-notification-channels.com/africastalking
Add your AfricasTalking username, key, and sender ID to your .env file. Ensure a valid sender ID is provided or leave AT_FROM empty.
```dotenv
AT_USERNAME=""
AT_KEY=""
AT_FROM="" // please note if you do not have a valid sender_ID remove this or leave it as ""
```
--------------------------------
### Install Discord Notification Channel via Composer
Source: https://laravel-notification-channels.com/discord
Use Composer to add the discord notification channel package to your Laravel project.
```bash
composer require laravel-notification-channels/discord
```
--------------------------------
### Create a Notification using the sipgate Channel
Source: https://laravel-notification-channels.com/sipgate
Use the 'sipgate' channel in your notifications after configuring credentials.
```php
class ExampleNotification extends Notification
{
public function via($notifiable)
{
return ['sipgate'];
}
public function toSipgate($notifiable)
{
return SipgateMessage::create('Your message goes hereā¦');
}
}
```
--------------------------------
### Handle Unknown Devices Event
Source: https://laravel-notification-channels.com/pushwoosh
Listen for the `UnknownDevices` event, which is dispatched when attempting to send notifications to non-existent devices.
```php
Event::listen(
NotificationChannels\Pushwoosh\Events\UnknownDevices::class,
function ($event) {
// Handle the event
}
);
```
--------------------------------
### Get Webex Message Representation
Source: https://laravel-notification-channels.com/webex
Defines the Webex Message representation for a notification. Supports plain text, Markdown, and file attachments.
```php
public function toWebex($notifiable)
{
return (new WebexMessage)
->text('The message, in plain text.')
->markdown('# The message, in Markdown format.')
->file(function (WebexMessageFile $file) {
$file->path('https://www.webex.com/content/dam/wbx/global/images/webex-favicon.png');
})
}
```
--------------------------------
### Consume Authy Notification
Source: https://laravel-notification-channels.com/authy
Dispatch a notification using the created Authy notification class. This example shows how to instantiate and send a notification with specific parameters.
```php
$this->notify(new \App\Notifications\PhoneVerificationNotification('sms', true));
```
--------------------------------
### Install Google Chat Notification Channel via Composer
Source: https://laravel-notification-channels.com/google-chat
Use this Composer command to add the Google Chat notification channel package to your Laravel project.
```bash
$ composer require laravel-notification-channels/google-chat
```
--------------------------------
### Publish Twilio Configuration File
Source: https://laravel-notification-channels.com/twilio
Run this Artisan command to publish the configuration file for the Twilio notification channel, allowing for advanced customization.
```bash
php artisan vendor:publish --provider="NotificationChannels\Twilio\TwilioProvider"
```
--------------------------------
### Add Start Group to Section
Source: https://laravel-notification-channels.com/microsoft-teams
Use this method to add a startGroup property to a section, marking the beginning of a logical group of information within a message card.
```php
$teams->addStartGroupToSection($sectionId = 'standard_section')
```
--------------------------------
### Send SMS Notification via SmsapiChannel
Source: https://laravel-notification-channels.com/smsapi
Example of a Laravel notification class configured to send SMS messages using the SmsapiChannel. Ensure your notifiable model has a `routeNotificationForSmsapi` method.
```php
use Illuminate\Notifications\Notification;
use NotificationChannels\Smsapi\SmsapiChannel;
use NotificationChannels\Smsapi\SmsapiSmsMessage;
class FlightFound extends Notification
{
public function via($notifiable)
{
return [SmsapiChannel::class];
}
public function toSmsapi($notifiable)
{
return (new SmsapiSmsMessage())->content("Buy now your flight!");
}
}
```
--------------------------------
### Configure 46Elks Service in Laravel
Source: https://laravel-notification-channels.com/46elks
Add the 46Elks service configuration to your application's `config/services.php` file. Ensure your `.env` file contains the necessary username and password.
```php
'46elks' => [
'username' => env('FORTY_SIX_ELKS_USERNAME'),
'password' => env('FORTY_SIX_ELKS_PASSWORD'),
],
```
```dotenv
FORTY_SIX_ELKS_USERNAME=
FORTY_SIX_ELKS_PASSWORD=
```
--------------------------------
### Create Notification Class for InterFAX
Source: https://laravel-notification-channels.com/interfax
Example of a Laravel notification class that sends documents via the InterFAX channel. It implements `InterfaxNotificationContract` and defines the `toInterfax` method to return an `InterfaxMessage`.
```php
files = $files;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [InterfaxChannel::class];
}
public function toInterfax($notifiable): InterfaxMessage
{
return (new InterfaxMessage)
->files($this->files);
}
}
```
--------------------------------
### WebexMessageFile Methods
Source: https://laravel-notification-channels.com/webex
Public methods available on the `\NotificationChannels\Webex\WebexMessageFile` class for configuring file details.
```APIDOC
## `WebexMessageFile` Class Methods
### `path(string $path)`
Sets the file path for the attachment.
### `name(string $name)`
Sets the user-provided name for the file.
### `type(string $type)`
Sets the MIME type for the file.
```
--------------------------------
### Configure Twilio Credentials in .env
Source: https://laravel-notification-channels.com/twilio
Set your Twilio Account SID, Auth Token, and other relevant details in your project's .env file for authentication and routing.
```dotenv
TWILIO_USERNAME=XYZ # optional when using auth token
TWILIO_PASSWORD=ZYX # optional when using auth token
TWILIO_AUTH_TOKEN=ABCD # optional when using username and password
TWILIO_ACCOUNT_SID=1234 # always required
TWILIO_FROM=100000000 # optional default from
TWILIO_ALPHA_SENDER=HELLO # optional
TWILIO_DEBUG_TO=23423423423 # Set a number that call calls/messages should be routed to for debugging
TWILIO_SMS_SERVICE_SID=MG0a0aaaaaa00aa00a00a000a00000a00a # Optional but recommended
TWILIO_SHORTEN_URLS=true # optional, enable URL shortener
```
--------------------------------
### Send BearyChat Notification with Message Object
Source: https://laravel-notification-channels.com/bearychat
Example of sending a BearyChat notification using the Message object within a Laravel Notification class. Requires BearyChatChannel and Message imports.
```php
text('foo')
->add('bar');
}
}
```
--------------------------------
### Publish Migrations
Source: https://laravel-notification-channels.com/webpush
Publish the package's migration files using the vendor:publish Artisan command.
```bash
php artisan vendor:publish --provider="NotificationChannels\WebPush\WebPushServiceProvider" --tag="migrations"
```
--------------------------------
### Send Webhook Notification in Laravel
Source: https://laravel-notification-channels.com/webhook
Configure your notification to use the WebhookChannel and define the webhook message content and headers. This example shows how to send custom data, user agent, and headers.
```php
use NotificationChannels\Webhook\WebhookChannel;
use NotificationChannels\Webhook\WebhookMessage;
use Illuminate\Notifications\Notification;
class ProjectCreated extends Notification
{
public function via($notifiable)
{
return [WebhookChannel::class];
}
public function toWebhook($notifiable)
{
return WebhookMessage::create()
->data([
'payload' => [
'webhook' => 'data'
]
])
->userAgent("Custom-User-Agent")
->header('X-Custom', 'Custom-Header');
}
}
```
--------------------------------
### Send MMS Notification via SmsapiChannel
Source: https://laravel-notification-channels.com/smsapi
Example of a Laravel notification class for sending MMS messages with an image using SmsapiChannel. Requires a `smil()` method to construct the SMIL content.
```php
use Illuminate\Notifications\Notification;
use NotificationChannels\Smsapi\SmsapiChannel;
use NotificationChannels\Smsapi\SmsapiMmsMessage;
class AnimalTrespassed extends Notification
{
public $photoId;
public function via($notifiable)
{
return [SmsapiChannel::class];
}
public function toSmsapi($notifiable)
{
return (new SmsapiMmsMessage())->subject('Animal!')->smil($this->smil());
}
private function smil()
{
$url = route('photos', ['id' => $this->photoId]);
$smil =
"" .
"" .
"" .
"" .
"" .
"" .
"" .
"
" .
"";
return $smil;
}
}
```
--------------------------------
### Run Laravel Tests
Source: https://laravel-notification-channels.com/vwo-engage
Execute the project's tests using PHPUnit.
```bash
$ php vendor/bin/phpunit
```
--------------------------------
### Create Authy Notification Class
Source: https://laravel-notification-channels.com/authy
Define a notification class that utilizes the AuthyChannel. This example demonstrates how to configure the notification method (sms/call), force delivery, and set custom action messages.
```php
// app/Notifications/PhoneVerificationNotification.php
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use NotificationChannels\Authy\AuthyChannel;
use NotificationChannels\Authy\AuthyMessage;
class PhoneVerificationNotification extends Notification
{
/**
* The notification method (sms/call).
*
* @var string
*/
public $method;
/**
* Determine whether to force the notification over cellphone network.
*
* @var bool
*/
public $force;
/**
* The notification message action.
*
* @var string
*/
public $action;
/**
* The notification message action message.
*
* @var string
*/
public $actionMessage;
/**
* Create a notification instance.
*
* @param string $method
* @param bool $force
* @param string $action
* @param string $actionMessage
*
* @return void
*/
public function __construct($method = 'sms', $force = false, $action = null, $actionMessage = null)
{
$this->method = $method;
$this->force = $force;
$this->action = $action;
$this->actionMessage = $actionMessage;
}
/**
* Get the notification's channels.
*
* @param mixed $notifiable
*
* @return array|string
*/
public function via($notifiable)
{
return [AuthyChannel::class];
}
/**
* Build the Authy representation of the notification.
*
* @return \NotificationChannels\Authy\AuthyMessage
*/
public function toAuthy()
{
$message = AuthyMessage::create()->method($this->method);
if ($this->force) {
$message->force();
}
if ($this->action) {
$message->action($action);
}
if ($this->actionMessage) {
$message->actionMessage($actionMessage);
}
return $message;
}
}
```
--------------------------------
### Link to Webex Room/Space
Source: https://laravel-notification-channels.com/webex
Include a link to a specific Webex room or space using its protocol handler. The format is `webexteams://im?space=`.
```php
public function toWebex($notifiable)
{
return (new WebexMessage)
->markdown('We are in the webexteams://im?space=f58064a0-8e21-11ec-9d53-739134f9a8eb space.');
}
```
--------------------------------
### Send Pushover Notification in Laravel
Source: https://laravel-notification-channels.com/pushover
Implement the `via` and `toPushover` methods in your Laravel Notification class to send a Pushover notification. This example demonstrates setting a title, sound, priority, and a supplementary URL.
```php
use NotificationChannels\Pushover\PushoverChannel;
use NotificationChannels\Pushover\PushoverMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [PushoverChannel::class];
}
public function toPushover($notifiable)
{
return PushoverMessage::create('The invoice has been paid.')
->title('Invoice paid')
->sound('incoming')
->lowPriority()
->url('http://example.com/invoices', 'Go to your invoices');
}
}
```
--------------------------------
### Send Trello Notification from Laravel
Source: https://laravel-notification-channels.com/trello
Use the `TrelloChannel` in your notification's `via` method and define the `toTrello` method to construct the `TrelloMessage`. This example creates a card with a name, description, and sets it to the top with a due date.
```php
use NotificationChannels\Trello\TrelloChannel;
use NotificationChannels\Trello\TrelloMessage;
use Illuminate\Notifications\Notification;
class ProjectCreated extends Notification
{
public function via($notifiable)
{
return [TrelloChannel::class];
}
public function toTrello($notifiable)
{
return TrelloMessage::create()
->name("Trello Card Name")
->description("This is the Trello card description")
->top()
->due('tomorrow');
}
}
```
--------------------------------
### Send a HipChat Room Notification with a Card
Source: https://laravel-notification-channels.com/hipchat
Utilize the `card` method to send rich notifications with titles, styles, URLs, icons, and custom attributes. This example demonstrates creating a card for a Laravel 5.3 announcement.
```php
public function toHipChat($notifiable)
{
return HipChatMessage::create()
->text('Laravel 5.3 has arrived!')
->notify(true)
->card(Card::create()
->title('Laravel')
->style(CardStyles::APPLICATION)
->url('http://laravel.com')
->html('Laravel 5.3 has arrived! The best release ever!')
->cardFormat(CardFormats::MEDIUM)
->icon('http://bit.ly/2c7ntiF')
->activity('Laravel 5.3 has arrived!', 'http://bit.ly/2c7ntiF')
->addAttribute(CardAttribute::create()
->label('Laravel Scout')
->icon('http://bit.ly/2c7ntiF')
->value('Driver based full-text search.')
->url('https://laravel.com/docs/5.3/scout')
)
->addAttribute(CardAttribute::create()
->label('Laravel Echo')
->icon('http://bit.ly/2c7ntiF')
->value('Event broadcasting, evolved.')
->url('https://laravel.com/docs/5.3/broadcasting')
)
->addAttribute(CardAttribute::create()
->label('Laravel Passport')
->icon('http://bit.ly/2c7ntiF')
->value('API authentication.')
->url('https://laravel.com/docs/5.3/passport')
)
);
}
```
--------------------------------
### Send Facebook Notification with Text and Buttons
Source: https://laravel-notification-channels.com/facebook
Example of sending a notification with text, a web URL button, a phone number button, and a postback button. The `to()` method specifies the recipient's Facebook Messenger ID.
```php
use NotificationChannels\Facebook\FacebookChannel;
use NotificationChannels\Facebook\FacebookMessage;
use NotificationChannels\Facebook\Components\Button;
use NotificationChannels\Facebook\Enums\NotificationType;
use Illuminate\Notifications\Notification;
class InvoicePaid extends Notification
{
public function via($notifiable)
{
return [FacebookChannel::class];
}
public function toFacebook($notifiable)
{
$url = url('/invoice/' . $this->invoice->id);
return FacebookMessage::create()
->to($notifiable->fb_messenger_user_id) // Optional
->text('One of your invoices has been paid!')
->isUpdate() // Optional
->isTypeRegular() // Optional
// Alternate method to provide the notification type.
// ->notificationType(NotificationType::REGULAR) // Optional
->buttons([
Button::create('View Invoice', $url)->isTypeWebUrl(),
Button::create('Call Us for Support!', '+1(212)555-2368')->isTypePhoneNumber(),
Button::create('Start Chatting', ['invoice_id' => $this->invoice->id])->isTypePostback() // Custom payload sent back to your server
]); // Buttons are optional as well.
}
}
```