All Projects → Nexmo → Laravel Notification

Nexmo / Laravel Notification

Licence: mit
Example package for using the (still under development) Messages API from Nexmo as a notification channel in Laravel

Projects that are alternatives of or similar to Laravel Notification

Laravel Slack Slash Command
Make a Laravel app respond to a slash command from Slack
Stars: ✭ 215 (+388.64%)
Mutual labels:  laravel, notifications
Webpush
Webpush notifications channel for Laravel.
Stars: ✭ 437 (+893.18%)
Mutual labels:  laravel, notifications
Laravel Desktop Notifier
💻 Send notifications to your desktop from your Laravel Artisan Commands. An JoliNotif wrapper for Laravel.
Stars: ✭ 333 (+656.82%)
Mutual labels:  laravel, notifications
Health
Laravel Health Panel
Stars: ✭ 1,774 (+3931.82%)
Mutual labels:  laravel, notifications
Laravel Server Monitor
Don't let your servers just melt down
Stars: ✭ 595 (+1252.27%)
Mutual labels:  laravel, notifications
Server Monitor App
A PHP application to monitor the health of your servers
Stars: ✭ 141 (+220.45%)
Mutual labels:  laravel, notifications
Statamic
Statamic 3: The New Site/App Package
Stars: ✭ 431 (+879.55%)
Mutual labels:  laravel, beta
Laravel Console Logger
Logging and Notifications for Laravel Console Commands.
Stars: ✭ 79 (+79.55%)
Mutual labels:  laravel, notifications
Laravel Failed Job Monitor
Get notified when a queued job fails
Stars: ✭ 582 (+1222.73%)
Mutual labels:  laravel, notifications
Larametrics
A self-hosted metrics and notifications platform for Laravel apps
Stars: ✭ 517 (+1075%)
Mutual labels:  laravel, notifications
Laravel Fcm
Firebase Cloud Messaging (FCM) sender for Laravel
Stars: ✭ 129 (+193.18%)
Mutual labels:  laravel, notifications
Laravel Smsgateway Notification Channel
SMS Gateway notification channel for Laravel
Stars: ✭ 13 (-70.45%)
Mutual labels:  laravel, notifications
Facebook
📨 Facebook Notifications Channel for Laravel
Stars: ✭ 120 (+172.73%)
Mutual labels:  laravel, notifications
Twilio
Twilio notifications channel for Laravel
Stars: ✭ 141 (+220.45%)
Mutual labels:  laravel, notifications
Project
⭐️ Antares Project Application Skeleton. This is the very first place you should start. It allows you to create a brand new awesome project in easy few steps.
Stars: ✭ 84 (+90.91%)
Mutual labels:  laravel, notifications
Laravel Onesignal
OneSignal Push Notifications for Laravel
Stars: ✭ 369 (+738.64%)
Mutual labels:  laravel, notifications
Laravel Fcm
🌐 A Laravel package to send Push Notifications to one or many devices of the user.
Stars: ✭ 56 (+27.27%)
Mutual labels:  laravel, notifications
Notifier
NO LIBRARIES socket per page bridge for your Laravel application. (CLIENT PART INCLUDED)
Stars: ✭ 57 (+29.55%)
Mutual labels:  laravel, notifications
Snooze
A package to simplify automating future notifications and reminders in Laravel
Stars: ✭ 515 (+1070.45%)
Mutual labels:  laravel, notifications
Laravel Notify
Flexible Flash notifications for Laravel
Stars: ✭ 787 (+1688.64%)
Mutual labels:  laravel, notifications

Nexmo / Laravel Notifications

Nexmo is now known as Vonage

Although Nexmo is available in Laravel as the default SMS provider, the next generation of Nexmo APIs will offer more communication channels. This package adds the ability to send notifications to WhatsApp, Facebook Messenger and Viber via Nexmo.

Note that the Messages API that this package uses has not yet had its stable release so both the API and this library are subject to change

Usage

To use this package, run composer require nexmo/laravel-notification. Once it completes, you can implement the following methods on your notification:

  • toNexmoWhatsApp
  • toNexmoFacebook
  • toNexmoViberServiceMessage
  • toNexmoSms

See examples/Notification/MerryChristmas.php for a complete example.

To send a notification, specify the channel you'd like to use:

// To a user
$user->notify(new \App\Notifications\MerryChristmas());

// To any person
Notification::route(
    'nexmo-whatsapp',
    'YOUR_NUMBER'
)->notify(new \App\Notifications\MerryChristmas());

The available channels are:

  • nexmo-sms
  • nexmo-whatsapp
  • nexmo-facebook
  • nexmo-viber_service_msg

As each notification receives a $notifiable (usually a user) it can decide how best to route the information. In this case, it checks the via_whatsapp property on the user and sends via WhatsApp if it's true. Otherwise it falls back to email

public function via($notifiable)
{
    return $notifiable->via_whatsapp ? ['nexmo-whatsapp'] : ['mail'];
}

Message Types

Nexmo supports multiple message types, depending on the channel that you're sending to. The Text type is the safest if you want to deliver to all channels:

public function toNexmoWhatsApp($notifiable)
{
    return (new \Nexmo\Notifications\Message\Text)
        ->content('This is a message being sent to WhatsApp');
}

Caveats

For some channels you need to send a templated message before you can send a free text message due to spam control rules. Here's an example of how to use a preapproved template intended for two-factor authentication purposes:

public function toNexmoWhatsApp($notifiable)
{
    return (new \Nexmo\Notifications\Message\Template)
        ->name("whatsapp:hsm:technology:nexmo:verify")
        ->parameters([
            ["default" => "Your Brand"],
            ["default" => "64873"],
            ["default" => "10"],
        ]);
}

If the recipient replies to your message, you can send them Text type messages without any issues

Configuration

Authentication

This notifications package is built on top of nexmo/laravel and uses the Nexmo client from there.

For this to work, you need to set your application ID and path to your private key in the .env file:

NEXMO_APPLICATION_ID=my_application_id
NEXMO_PRIVATE_KEY=./private.key

Setting the from address

You can set a fromaddress via the .env file. This package will look for provider specific entries before falling back to NEXMO_FROM.

NEXMO_FROM_SMS=""
NEXMO_FROM_WHATSAPP=""
NEXMO_FROM_MESSENGER=""
NEXMO_FROM_VIBER_SERVICE_MSG=""
NEXMO_FROM="" # This is the default if any of the above aren't set

Alternatively, you can set a from address for a single notification by calling the ->from() method on a message:

public function toNexmoViberServiceMessage($notifiable)
{
    return (new Text)->content('Merry Christmas Viber!')->from("YOUR_ID");
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].