masonite icon indicating copy to clipboard operation
masonite copied to clipboard

Issue while sending sms to a single user through vonage

Open Bindukarkee opened this issue 3 years ago • 3 comments

Describe the bug

While sending sms(vonage) through notification, I entered user phone number in to_ recipients which is in string format following the correct E.164 format. But while sending sms an error occured saying "Vonage Code [3]: to address is not valid. Please refer to API documentation for more details."

User model

class User(Model, Authenticates, Notifiable):
    def route_notification_for_vonage(self):
        return self.phone

Job

from masonite.queues import Queueable
from app.models.User import User
from app.notifications.TestNotification import TestNotification

class TestJob(Queueable):
    def handle(self):
        user = User.where('id', 1).first()

        from wsgi import application
        notification = application.make('notification')
        notification.send(user, TestNotification())

Notification

from masonite.notification import Notification
from masonite.mail import Mailable
from masonite.notification import Sms

class TestNotification(Notification, Mailable):

    def to_vonage(self, notifiable):
        return Sms().text("Test message" )

    def via(self, notifiable):
        return ["vonage"]

Expected behaviour

After sending sms end user must be able to receive sms but it is throwing error "Vonage Code [3]: to address is not valid". Here to field is expecting a list but the value which I entered is string. So, sms notification must be able to handle the condition when a single user is being sent where phone no. could be in string.

Steps to reproduce the bug

No response

Screenshots

No response

OS

Linux

OS version

Ubuntu 18.04

Browser

No response

Masonite Version

=4.7.1

Anything else ?

No response

Bindukarkee avatar Jun 17 '22 06:06 Bindukarkee

@Bindukarkee The phone's value is filled?

Marlysson avatar Jun 19 '22 13:06 Marlysson

Yes, the phone's value is filled. The issue doesn't occur when the value is send inside array.

Bindukarkee avatar Jun 21 '22 06:06 Bindukarkee

We will take a look asap ! 😉

girardinsamuel avatar Jun 21 '22 09:06 girardinsamuel