diff --git a/src/Utopia/Messaging/Adapters/SMS/AfricasTalking.php b/src/Utopia/Messaging/Adapters/SMS/AfricasTalking.php new file mode 100644 index 00000000..71f15d63 --- /dev/null +++ b/src/Utopia/Messaging/Adapters/SMS/AfricasTalking.php @@ -0,0 +1,57 @@ +request( + method: 'POST', + url: "https://api.sandbox.africastalking.com/version1/messaging", + // live endpoint: url: "https://api.africastalking.com/version1/messaging ", + headers: [ + 'apiKey: '.$this->apiKey, + 'Content-Type: application/x-www-form-urlencoded', + 'Accept: application/json', + ], + body: \http_build_query([ + 'username' => $this->username, + 'to' => $message->getTo()[0], + 'message' => $message->getContent(), + ]), + ); + } +} \ No newline at end of file diff --git a/tests/e2e/SMS/AfricasTalkingTest.php b/tests/e2e/SMS/AfricasTalkingTest.php new file mode 100644 index 00000000..6b85250e --- /dev/null +++ b/tests/e2e/SMS/AfricasTalkingTest.php @@ -0,0 +1,34 @@ +send($message); + $result = \json_decode($response, true); + + $this->assertNotEmpty($result); + } +} \ No newline at end of file