diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 552b207d..f2ab9d0e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,6 +25,7 @@ jobs: TWILIO_FROM: ${{ secrets.TWILIO_FROM }} TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }} TELNYX_PUBLIC_KEY: ${{ secrets.TELNYX_PUBLIC_KEY }} + AWSSNS_API_GATEWAY_URL: ${{ secrets.AWSSNS_API_GATEWAY_URL }} APNS_AUTHKEY_8KVVCLA3HL: ${{ secrets.APNS_AUTHKEY_8KVVCLA3HL }} APNS_AUTH_ID: ${{ secrets.APNS_AUTH_ID }} APNS_TEAM_ID: ${{ secrets.APNS_TEAM_ID }} diff --git a/docker-compose.yml b/docker-compose.yml index 80d626d9..492d6a50 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: - TWILIO_FROM - TELNYX_API_KEY - TELNYX_PUBLIC_KEY + - AWSSNS_API_GATEWAY_URL - APNS_AUTHKEY_8KVVCLA3HL - APNS_AUTH_ID - APNS_TEAM_ID diff --git a/src/Utopia/Messaging/Adapters/Push/AWSSNS.php b/src/Utopia/Messaging/Adapters/Push/AWSSNS.php new file mode 100644 index 00000000..1326c873 --- /dev/null +++ b/src/Utopia/Messaging/Adapters/Push/AWSSNS.php @@ -0,0 +1,62 @@ + $message->getData() + ]; + + // Make the HTTP request + $response = $this->request( + method: 'POST', + url: $this->apiGatewayUrl, + headers: [ + 'Content-Type: application/json', + ], + body: json_encode($payload) + ); + + return $response; + } +} diff --git a/tests/e2e/Push/AWSSNSTest.php b/tests/e2e/Push/AWSSNSTest.php new file mode 100644 index 00000000..cabde95a --- /dev/null +++ b/tests/e2e/Push/AWSSNSTest.php @@ -0,0 +1,26 @@ +send($message), true); + + $this->assertNotEmpty($response); + $this->assertEquals('success', $response['status'] ?? null); + $this->assertNotEmpty($response['MessageId'] ?? null); + } +}