Closed scramatte closed 2 years ago
Hi @scramatte , I couldn't exactly get your point.
You can send a SMS to multiple users by following steps:
A) Fetch users mobile in an Array like:
$mobiles = App\User::where('id','>=',100)
->get()
->pluck('mobile')
->toArray();
B) Send SMS using:
smsapi()->sendMessage($mobiles, $message);
I had a look at your Gateway API docs. You can use the wrapper
functionality to send the SMS.
But I don't think your gateway accepts multiple numbers in one request. They want a different sub-request for each destination number like:
{
"from":"GOOD PIZZA",
"to":"34666666111",
"text":"Hi John, today 2x1 in pizzas, watch the game like a boss with our new pepperoni pizza!",
"send_at":"2018-02-18 17:30:00"
},
{
"from":"GOOD PIZZA",
"to":"34666666112",
"text":"Hi Maria, , today 2x1 in pizzas, watch the game like a boss with our new pepperoni pizza!",
"custom":"MyMsgID-12345",
"send_at":"2018-02-18 17:30:00"
}
Hi,
Sorry for very very late reply ...
I'm back on my Laravel project and what I need is just to be able to pass and array or a string into routeNotificationForSmsApi() because my customers has various mobiles, emails and my app use many many Notifications ...
The way you comment of course works but it's not usable in the context of my app. Can you make the patch ?
Just construct the method in your Model like so:
public function routeNotificationForMail($notification)
{
return [$this->phone, $this->phone2];
}
Hello,
Yes , I've solved it in similar way.
Hello,
Can you add support for multiple phone numbers in notification channel and send message ? I've made a dirty patch into SmsApiChannel.php but requires loop to send different messages.
In the api I use, it possible to send various SMS in one call https://panel.smspubli.com/api/3.0/docs/sms/send
For sur it's possible to improve it on your side.
SmsApiChannel.php