Custom Gateway Setup
By setting up a custom gateway, you gain full control over communications and data. However, this process requires technical skills and infrastructure. Before starting, please consider the Private Server mode, as it offers additional privacy features and is not significantly different from a self-built solution, with much fewer setup operations required.
Before You Begin
As of the time of writing this document, the backend in its default configuration exposes public endpoints. Therefore, anyone who knows the server address can connect a mobile app to it and use the API.
Please be aware that these instructions are simplified and do not cover detailed security configurations, such as firewall settings and HTTPS setup. Implementing these security measures is the user's responsibility.
Use at your own risk.
Prerequisites
- Android Studio with the Android SDK installed.
- A Google Firebase account and a project with Cloud Messaging activated.
- A MySQL or MariaDB database.
- A VPS (Virtual Private Server) with a public IP address.
- A reverse proxy such as Nginx or Traefik with HTTPS support.
- Go programming language with the latest version installed (only necessary for using private server mode).
Backend
If you do not plan to use the private server mode, there is no need to rebuild the backend. You can follow the instructions for the Private Server mode with the following changes:
- Set the
gateway.mode
value topublic
. - Update the
fcm.credentials_json
with the content of your Firebase project's credentials JSON file.
Private Server Mode
To use the private server mode, you must rebuild the backend after modifying the file at internal/sms-gateway/modules/push/upstream/client.go
to set your main server address. You can then build the binary by executing make build
or the Docker image by running make docker-build
.
Android App
To build a custom version of the Android application that will communicate with your server, follow these steps:
- Clone the repository at https://github.com/capcom6/android-sms-gateway and open it in Android Studio.
- Navigate to
app/src/main/java/me/capcom/smsgateway/modules/gateway/GatewayApi.kt
and update theBASE_URL
constant to your server's URL. - Modify the
applicationId
inapp/build.gradle
to a unique value. - Refer to the instructions at https://firebase.google.com/docs/android/setup to register your application and generate the
google-services.json
file. - Build and run the application.