httpSMS is a service that lets you use your Android phone as an SMS Gateway to send and receive SMS messages. You make a request to a simple HTTP API and it triggers your Android phone to send an SMS. SMS messages received on your android phone can also be forwarded to your webhook endpoint.
Quick Start Guide 👉 https://docs.httpsms.com
I'm originally from Cameroon and I wanted an automated way to send and receive SMS messages using an API. Unfortunately many countries don't support the ability to buy virtual phone numbers, and I could not find a good ready-made solution that could help me send/receive SMS messages using a mobile phone using an intuitive http API.
The web interface https://httpsms.com is built using Nuxt and Vuetify. It is hosted as a single page application on firebase. The source code is in the web directory
The API https://api.httpsms.com is built using Fiber, Go and CockroachDB for the database. It rus as a serverless application on Google Cloud Run. The API documentation can be found here https://api.httpsms.com/index.html
// Sending an SMS Message using Go
client := htpsms.New(htpsms.WithAPIKey(/* API Key from https://httpsms.com/settings */))
client.Messages.Send(context.Background(), &httpsms.MessageSendParams{
Content: "This is a sample text message",
From: "+18005550199",
To: "+18005550100",
})
The Android App is a native application built using Kotlin with material design principles. This app must be installed on an Android phone before you can start sending and receiving SMS messages.
There are a few ways to get in touch with me and/or the rest of the community. Feel free to use any of these methods. Whatever works best for you:
- Discord server - direct chat with the community
- GitHub issues - questions, features, bugs
You can encrypt your messages end-to-end ysubg the military grade AES-256 encryption algorithm. Your encryption key is stored only on our mobile phone so the even the server won't have any way to view the content of your SMS messages which are sent and received on your Android phone.
If you want to build advanced integrations, we support webhooks. The httpSMS platform can forward SMS messages received on the android phone to your server using a callback URL which you provide.
In-order not to abuse the SMS API on android, you can set a rate limit e.g 3 messages per minute. Such that even if you call the API to send messages to 100 people, It will only send the messages at a rate of 3 messages per minute.
Sometimes it happens that the phone doesn't get the push notification in time and I can't send the SMS message. It is possible to set a timeout for which a message is valid and if a message becomes expired after the timeout elapses, you will be notified.
- Go: https://github.com/NdoleStudio/httpsms-go
- JavaScript/TypeScript: https://github.com/NdoleStudio/httpsms-node
sequenceDiagram
User->>+httpSMS API: Call /v1/messages/send API
httpSMS API-->>+Push Queue: Schedule notification about new message
httpSMS API-->>-User: Respond with 202 (Accepted)
Push Queue-->>+httpSMS API: [Async] Send notification request
httpSMS API-->>-Android App: Send push notification about new message
Android App-->>httpSMS API: [Async] Fetch message
Android App-->>Android App: Send Message using Android SMS API
Android App-->>httpSMS API: [Async] Send result of sending SMS
Android App-->>httpSMS API: [Async] Send Delivery Report
- The httpSMS application uses firebase cloud messaging for sending push notifications to your Android phone to trigger an SMS message to be sent out.
Visit the firebase console and create a new project and follow the steps here to get your firebase web SDK config credentials.
For example, I created a firebase project called
httpsms-docker
and this is my web SDK configuration
const firebaseConfig = {
apiKey: "AIzaSyAKqPvj51igvvNNcRt_gL0A6cgx3ZB-kuQ",
authDomain: "httpsms-docker.firebaseapp.com",
projectId: "httpsms-docker",
storageBucket: "httpsms-docker.appspot.com",
messagingSenderId: "668063041624",
appId: "1:668063041624:web:29b9e3b7027965ba08a22d",
measurementId: "G-18VRYL22PZ",
};
- Enable
Email/Password
sign-in in the Firebase console, open the Authentication section. On the Sign in method tab, enable theEmail/password
sign-in method and clickSave
.- The firebase
email/password
sign-in method has a bug which prevents you from signing in. The work around right now is to disable email enumeration protection on the firebase console.
- The firebase
- Generate your firebase service account credentials by following the steps here and save the credentials in a file called
firebase-credentials.json
we will use this file to authenticate with the firebase admin SDK. - Generate your Android
google-services.json
file using the instructions here we will use it letter to configure the android app.
The httpSMS application uses SMTP to send emails to users e.g. when your Android phone has been offline for a long period of time. You can use a service like mailtrap to create an SMTP server for development purposes.
Clone the httpSMS GitHub repository
git clone https://github.com/NdoleStudio/httpsms.git
- Copy the
.env.docker
file in theweb
directory into.env
cp web/.env.local.docker web/.env.local
- Update the environment variables in the
.env
file in theweb
directory with your firebase web SDK configuration in step 1 above
FIREBASE_API_KEY=
FIREBASE_AUTH_DOMAIN=
FIREBASE_PROJECT_ID=
FIREBASE_STORAGE_BUCKET=
FIREBASE_MESSAGING_SENDER_ID=
FIREBASE_APP_ID=
FIREBASE_MEASUREMENT_ID=
- Copy the
.env.docker
file in theapi
directory into.env
cp api/.env.local.docker api/.env.local
- Update the environment variables in the
.env
file in theapi
directory with your firebase service account credentials and SMTP server details.
# SMTP email server settings
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_HOST=
SMTP_PORT=
# Firebase service account credentials
FIREBASE_CREDENTIALS=
# This is the `projectId` from your firebase web config
GCP_PROJECT_ID=
- Don't bother about the
EVENTS_QUEUE_USER_API_KEY
andEVENTS_QUEUE_USER_ID
settings. We will set that up later.
- 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. When it's finished, you'll be able to access the web UI at http://localhost:3000 and the API at http://localhost:8000
docker compose up --build
- 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. Make sure you use the sameid
andapi_key
as theEVENTS_QUEUE_USER_ID
, andEVENTS_QUEUE_USER_API_KEY
in your.env
file
- Before building the Android app in Android Studio, you need to replace the
google-services.json
file in theandroid/app
directory with the file which you got from step 1. You need to do this for the firebase FCM messages to work properly.
This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 - see the LICENSE file for details