africastalking-php icon indicating copy to clipboard operation
africastalking-php copied to clipboard

Sending Batch Messages

Open vmosoti opened this issue 6 years ago • 3 comments

How do we achieve batch sending in cases where there is a unique phone number/message combination?

Something like this:

$sms->send([
        [
            'to' => '0722123456',
            'message' => 'This is a unique message'
        ],
        [
            'to' => '0713678900',
            'message' => 'this is another unique message'
         ],
         [
            'to' => '0712345678',
            'message' => 'even another one'
         ],
]);

What is available is sending a similar message to an array of numbers, or maybe am missing something ...

vmosoti avatar Feb 08 '19 06:02 vmosoti

I've also hit this issue as $sms->send([...]) is blocking and sending one SMS after another is unacceptable (as it takes close to 1 second).

I've settled for forking the project to implement asynchronous calling of the API, I'll be raising a PR here in a few.

codingedward avatar Jun 04 '19 14:06 codingedward

@codingedward did you manage to implement the asynchronous feature

marvinhosea avatar Jan 27 '20 17:01 marvinhosea

In fact, I was able to achieve this by changing this part of the doSend function:

https://github.com/codingedward/africastalking-php/blob/de5d551477b5a279eb5efb0f7dba8b9e0d42380b/src/SMS.php#L54-L56

codingedward avatar Jan 27 '20 19:01 codingedward