Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sender name is not Alphanumeric, number instead #112

Open
hazem-taha opened this issue Dec 8, 2020 · 0 comments
Open

Sender name is not Alphanumeric, number instead #112

hazem-taha opened this issue Dec 8, 2020 · 0 comments

Comments

@hazem-taha
Copy link

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);
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant