Laravel 7/6 Send Notifications as Voice Call
Laravel 28-Nov-2020

Laravel 7/6 Send Notifications as Voice Call

Send notification as voice call in Laravel. In this tutorial, we will learn how to use send notification as Voice or Phone call in laravel.

Here we will discuss nexmo-voice-channel for the send voice notification.

This package provides a notification channel for the Laravel framework that works with Nexmo’s voice API, allowing text-to-speech phone calls. It also provides a fluent interface to construct your message content.

1. Install notifcation package

Now open your command prompt and go to your project root directory and type the below command for install the package via Composer:

 composer require roomies/nexmo-voice-channel 

2. Configure nexmo credentials in .env

Go to your project root directory and set the nexmo credentials in .env file:


Then add your call from number and voice to config/services.php under the nexmo key. You can review the available voices in the Nexmo documentation.

'nexmo' => [
    'call_from' => env('NEXMO_CALL_FROM'),
    'call_voice' => env('NEXMO_CALL_VOICE', 'Kimberly'),

3. Create a Notification channel

In this step, create a notification channel and put the update the below methods in your channel:

use Roomies\NexmoVoiceChannel\Markup\Message;
use Roomies\NexmoVoiceChannel\Markup\SayAs;
use Roomies\NexmoVoiceChannel\Markup\Sentence;
use Roomies\NexmoVoiceChannel\NexmoVoiceChannel;
 * Get the notification's delivery channels.
 * @param  mixed  $notifiable
 * @return array
public function via($notifiable)
    return [NexmoVoiceChannel::class];
 * Get the voice representation of the notification.
 * @param  mixed  $notifiable
 * @return \Roomies\NexmoVoiceChannel\Markup\Message
public function toVoice($notifiable)
    return new Message([
        new Sentence('Hi, thanks for joining Roomies.'),
        new Sentence([
            'Your verification code is',
            new SayAs('ABC123')->interpretAs('spell-out')

In the below is another example demonstrating the package’s markup types you can use to create a notification:

new Sentence([
    (new Pause)->time('1s'),
    (new Prosody('Wake up!'))->volume('loud'),
    (new Substitution(
        (new SayAs('US'))->interpretAs('spell-out'),
    ))->alias('United States'),

If you want to learn more about this package, get full installation instructions, and view the source code on GitHub at roomies-com/nexmo-voice-channel.