2

Hello i am using twilio in my project builted on laravel framework. Its stated in twilio site that "For sending sms to multiple number you need to add all numbers in an array and make seperate call for each number using iteration". I am doing the same but its till sending multiple message to only first number instead of sending sms to multiple numbers. here is my code.

foreach ($numbers as $number) {
Twilio::sms(['to' => [$number],'message' => 'Hi']);
 }

$numbers Contains two numbers +9234222***** and +9231102***** But i am recieving two messages on +9234222***** instead of one on each. And in my twilio dashboard its showing 2 segments for +9234222***** and +9231102***** is not there.

UPDATE I have found the solution for sending same message to multiple numbers . for sending sms to multiple numbers simply pass the array $numbers in 'to' instead of loop. Twilio::sms(['to' => $numbers,'message' => 'Hi']);

Still waiting for best answer. What if i want to send message with Name. e.g 'Hi John' on +9234222***** and 'HI Doe' on +9231102*****.

Note: I am using https://github.com/j42/laravel-twilio

Sama
  • 351
  • 3
  • 14
  • Why are you using sms method? Not one of these: https://github.com/aloha/laravel-twilio and why is 'to' an array instead of a single value == $number? – Marcin Sep 26 '16 at 20:17
  • `foreach ($numbers as $number) { Twilio::sms(['to' => $number,'message' => 'Hi']); } ` I have just tried this and its sending message to both numbers but with 2 segments on both numbers. And Yes laravel-twilio package is installed in my project but didnt remember why i didnt used that i had stopped working on this project 4 month ago now i started it again. Is there any drawback of using sms method? – Sama Sep 26 '16 at 20:25
  • No, I just saw other methods listed there, that's why iIasked, could not find docs on sms method – Marcin Sep 26 '16 at 20:26
  • I am using this for sms method if anyone needed it, can find here https://github.com/j42/laravel-twilio . – Sama Sep 26 '16 at 21:40

1 Answers1

0

UPDATE I have found the solution for sending same message to multiple numbers . for sending sms to multiple numbers simply pass the array $numbers in 'to' instead of loop. Twilio::sms(['to' => $numbers,'message' => 'Hi']);

Still waiting for best answer. What if i want to send message with Name. e.g 'Hi John' on +9234222***** and 'HI Doe' on +9231102*****

Megan Speir
  • 3,745
  • 1
  • 15
  • 25