Skip to content

Commit 0cf0224

Browse files
committed
allow groups.
1 parent 752ec29 commit 0cf0224

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Cloudwa.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function sendMessage(array $inputs = []): Collection
175175
->map(function ($phone) use ($inputs) {
176176
$data = [
177177
'session_uuid' => $this->sessionUuid ?? config('cloudwa.uuids.default'),
178-
'phone' => $phone,
178+
'chat_id' => $phone,
179179
'message' => $this->message ?? null,
180180
'template_parameters' => $this->templateParameters ?? null,
181181
'schedule_at' => $this->scheduleAt,
@@ -300,6 +300,11 @@ public static function generateWaCallback(string $reference, string $code): arra
300300
*/
301301
private function normalizeNumber(string $phone): string
302302
{
303+
// if it's group, then do nothing.
304+
if (str_contains($phone, '@g.us')) {
305+
return $phone;
306+
}
307+
303308
if (! str($phone)->startsWith('https://chat.whatsapp.com/')) {
304309
// Remove All Non-Digits
305310
$phone = preg_replace('/\D/', '', $phone);

0 commit comments

Comments
 (0)