diff --git a/README.md b/README.md index d745b630..140ac551 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ $messaging->send($message); - [x] [TextMagic](https://www.textmagic.com/) - [x] [Msg91](https://msg91.com/) - [x] [Vonage](https://www.vonage.com/) +- [x] [ClickSend](https://www.clicksend.com/) - [x] [Plivo](https://www.plivo.com/) - [x] [Infobip](https://www.infobip.com/) - [x] [Clickatell](https://www.clickatell.com/) @@ -108,7 +109,7 @@ $messaging->send($message); ### Push - [x] [FCM](https://firebase.google.com/docs/cloud-messaging) -- [ ] [APNS](https://developer.apple.com/documentation/usernotifications) +- [x] [APNS](https://developer.apple.com/documentation/usernotifications) - [ ] [OneSignal](https://onesignal.com/) - [ ] [Pusher](https://pusher.com/) - [ ] [WebPush](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) diff --git a/src/Utopia/Messaging/Adapters/SMS/ClickSend.php b/src/Utopia/Messaging/Adapters/SMS/ClickSend.php new file mode 100644 index 00000000..9be69731 --- /dev/null +++ b/src/Utopia/Messaging/Adapters/SMS/ClickSend.php @@ -0,0 +1,64 @@ + \ltrim($to, '+'), + $message->getTo() + ); + $body = []; + foreach ($toList as $to) { + $body[] = [ + 'body' => $message->getContent(), + 'from' => $message->getFrom(), + 'to' => $to + ]; + } + + return $this->request( + method: 'POST', + url: 'https://rest.clicksend.com/v3/sms/send', + headers: [ + 'Content-Type: application/json', + 'Authorization: Basic ' . base64_encode("{$this->username}:{$this->apiKey}"), + ], + body: \json_encode([ + 'messages' => $body + ]), + ); + } +}