Skip to content

Sender name is not Alphanumeric, number instead #112

@hazem-taha

Description

@hazem-taha

Hello,

I'm using (Laravel v6, package version: 3.1.2)

Using code like this sends the from name as String as needed, but using notification and TwilioChannel::class as channel sends the from name is the twilio's registered number not a string.

Before it is working perfectly, but now it is not, I believe it happened after upgrading twilio/sdk package

// Your Account SID and Auth Token from twilio.com/console
        $sid = env('TWILIO_SID');
        $token = env('TWILIO_TOKEN');
        $client = new Client($sid, $token);

        $validator = Validator::make($request->all(), [
            'numbers' => 'required',
            'message' => 'required'
        ]);

        if ($validator->passes()) {

            $numbers_in_arrays = explode(',', $request->input('numbers'));

            $message = $request->input('message');
            $count = 0;

            foreach ($numbers_in_arrays as $number) {
//              Notification::route('twilio', $number)->notify(new \App\Notifications\SomeNotification());

                $count++;

                $client->messages->create(
                    $number,
                    [
                        'from' => 'Test Sender',
                        'body' => $message,
                    ]
                );
            }

            return back()->with('success', $count . " messages sent!");

        } else {
            return back()->withErrors($validator);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions