getTo() as $recipient) { $recipients[] = [ 'mobiles' => \ltrim($recipient, '+'), 'content' => $message->getContent(), 'otp' => $message->getContent(), ]; } $response = new Response($this->getType()); $result = $this->request( method: 'POST', url: 'https://api.msg91.com/api/v5/flow/', headers: [ 'Content-Type: application/json', 'Authkey: '. $this->authKey, ], body: [ 'sender' => $this->senderId, 'template_id' => $this->templateId, 'recipients' => $recipients, ], ); if ($result['statusCode'] === 200) { $response->setDeliveredTo(\count($message->getTo())); foreach ($message->getTo() as $to) { $response->addResult($to); } } else { foreach ($message->getTo() as $to) { $response->addResult($to, 'Unknown error'); } } return $response->toArray(); } }