Search code examples
laravelnotificationsvonage

Change Sender Name from Verify to My company name in laravel using nexmo


I try to change the message title provided by nexom "verify" to be my company name. I upgrade my nexmo account and put money in it. I try use from But NOT work.

this my notification

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\NexmoMessage;
//use App\admin\Course;

class ConfirmedCourse extends Notification
{
    use Queueable;
    protected $course;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($course)
    {
     $this->course = $course;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['nexmo'];
    }

 public function toNexmo($notifiable)
    {
      try {
     $message = new NexmoMessage(); 
     $message->from('basma center')->content($this->course)
         ->unicode();
     return $message;
    }catch (\Exception $e) {
    $e->getMessage();
    }
 }  
}

enter image description here

How Can I solve this problem please ?? thank in advance


Solution

  • Looking over the code from Laravel, I believe what you are doing is correct, as it looks like they pass your "from" setting back up the notification stack. The only thing I can think off the top of my head is possibly country restrictions, as different countries have different SMS requirements for the sender data.

    You may want to check the Country Specific Features and Recommendations list to see if the carrier is overriding this.

    Also keep in mind that Laravel Notifications are pure SMS messages, they are not our Verify product. You are much more restricted in what you can set as the "from" option with raw SMS (See the country restrictions above).