MasoniteFramework / masonite

The Modern And Developer Centric Python Web Framework. Be sure to read the documentation and join the Discord channel for questions: https://discord.gg/TwKeFahmPZ
http://docs.masoniteproject.com
MIT License
2.19k stars 128 forks source link

Issue while sending sms to a single user through vonage #671

Open Bindukarkee opened 2 years ago

Bindukarkee commented 2 years ago

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

Marlysson commented 2 years ago

@Bindukarkee The phone's value is filled?

Bindukarkee commented 2 years ago

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

girardinsamuel commented 2 years ago

We will take a look asap ! 😉