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

Multiple messages send to same user #6

Closed
tiipiik opened this issue Jan 30, 2017 · 3 comments
Closed

Multiple messages send to same user #6

tiipiik opened this issue Jan 30, 2017 · 3 comments

Comments

@tiipiik
Copy link
Contributor

tiipiik commented Jan 30, 2017

Hi,

I'm using your plugin to send messages to users about meetings.
Actually all messages are send to the first number. If I use the Log gateway it records every message send to the good user (different from what it really appends), so I think it's probably a mistake in my code but I can't find where.
Any help would be greatly appreciated.

use Softon\Sms\Facades\Sms;

public function sendingSms()
{
    $day = Carbon::now();

    $fake_meetings = collect([]);

    $first = new stdClass();
    $first->phone = '0600000000';
    $first->date = $day->copy()->setDate(2017, 2, 21)->setTime(9, 0, 0);
    $fake_meetings->push($first);

    $second = new stdClass();
    $second->phone = '0600000001';
    $second->date = $day->copy()->setDate(2017, 2, 21)->setTime(9, 20, 0);
    $fake_meetings->push($second);

    $fake_meetings->each(function ($meeting) {
        $date = $meeting->date;
        $date = utf8_encode($date->formatLocalized('%A %d %B %Y %H:%M'));

        $message_datas = [
            'begins_at' => $date,
        ];

        self::getSmsRecall($meeting->phone, $message_datas);
    });
}

And the method that use your plugin to send messages

private static function getSmsRecall($phone, $message_datas)
{
    $r = Sms::send($phone, 'sms.recall', [
        'begins_at' => $message_datas['begins_at'],
    ]);
}
@tiipiik
Copy link
Contributor Author

tiipiik commented Feb 7, 2017

I finally find the origin of the problem : in your ClickatellGateway.php you did not define the $this->request variable in the getUrl() method, so $this->request will concatenate all the requests passed.

Add

$this->request = '';

on line 25 fixed the problem.

@softon
Copy link
Owner

softon commented Apr 3, 2017

Its there in line 13. also the function composeBulkMobile() handles the concatenating of the numbers.

@tiipiik
Copy link
Contributor Author

tiipiik commented Apr 3, 2017

Oh yeah your totally right, but for me it didn't seems to work and I have had to add this line to get things done properly.
Maybe it's only for me and the issue is not due to your code directly.

@softon softon closed this as completed May 1, 2017
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

2 participants