You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The httpSMS application uses [firebase cloud messaging](https://firebase.google.com/docs/cloud-messaging) for sending push notifications to your Android phone to trigger an SMS message to be sent out.
139
+
Visit the [firebase console](https://console.firebase.google.com/) and create a new project and follow the [steps here](https://firebase.google.com/docs/web/setup#register-app) to get your firebase web SDK config credentials.
140
+
For example, I created a firebase project called `httpsms-docker` and this is my web SDK configuration
- Enable `Email/Password` sign-in in the [Firebase console](https://console.firebase.google.com/u/0/), open the **Authentication** section. On the Sign in method tab, enable the `Email/password` sign-in method and click `Save`.
155
+
- Generate your firebase service account credentials by following the [steps here](https://firebase.google.com/docs/admin/setup#initialize_the_sdk_in_non-google_environments) and save the credentials in a file called `firebase-credentials.json` we will use this file to authenticate with the firebase admin SDK.
156
+
- Generate your Android `google-services.json` file using [the instructions here](https://support.google.com/firebase/answer/7015592?hl=en#android&zippy=%2Cin-this-article) we will use it letter to configure the android app.
157
+
158
+
### 2. Setup SMTP Email service
159
+
160
+
The httpSMS application uses [SMTP](https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol) to send emails to users e.g. when your Android phone has been offline for a long period of time.
161
+
You can use a service like [mailtrap](https://mailtrap.io/) to create an SMTP server for development purposes.
- Copy the `.env.docker` file in the `web` directory into `.env` and update the environment variables with your firebase web SDK configuration.
174
+
175
+
```bash
176
+
cp web/.env.local.docker web/.env.local
177
+
```
178
+
179
+
- Copy the `.env.docker` file in the `api` directory into `.env`
180
+
181
+
```bash
182
+
cp api/.env.local.docker api/.env.local
183
+
```
184
+
185
+
- Update the environment variables in the `.env` file in the `api` directory with your firebase service account credentials and SMTP server details.
186
+
187
+
```dotenv
188
+
# SMTP email server settings
189
+
SMTP_USERNAME=
190
+
SMTP_PASSWORD=
191
+
SMTP_HOST=
192
+
SMTP_PORT=
193
+
194
+
# Firebase service account credentials
195
+
FIREBASE_CREDENTIALS=
196
+
197
+
# This is the `projectId` from your firebase web config
198
+
GCP_PROJECT_ID=
199
+
```
200
+
201
+
- Don't bother about the `EVENTS_QUEUE_USER_API_KEY` and `EVENTS_QUEUE_USER_ID` settings. We will set that up later.
202
+
203
+
### 5. Build and Run
204
+
205
+
Build and run the API, the web UI, database and cache using the `docker-compose.yml` file. It takes a while for build and download all the docker images.
206
+
When it's finished, you'll be able to access the web UI at http://localhost:3000 and the API at http://localhost:8000
207
+
208
+
```bash
209
+
docker compose up --build
210
+
```
211
+
212
+
### 6. Create the System User
213
+
214
+
The application uses the concept of a system user to process events async. You should manually create this user in `users` table in your database.
215
+
Make sure you use the same `id` and `api_key` as the `EVENTS_QUEUE_USER_ID`, and `EVENTS_QUEUE_USER_API_KEY` in your `.env` file
216
+
217
+
### 7. Build the Android App.
218
+
219
+
Before building the Android app in [Android Studio](https://developer.android.com/studio), you need to replace the `google-services.json` file in the `android/app` directory with the file which you got from step 1. You need to do this for the firebase FCM messages to work properly.
220
+
106
221
## License
107
222
108
223
This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 - see the [LICENSE](LICENSE) file for details
0 commit comments