https://github.com/nexmo/node-sms-proxy
SMS Proxy using Node and the Nexmo SMS API
https://github.com/nexmo/node-sms-proxy
Last synced: 12 months ago
JSON representation
SMS Proxy using Node and the Nexmo SMS API
- Host: GitHub
- URL: https://github.com/nexmo/node-sms-proxy
- Owner: Nexmo
- License: mit
- Created: 2016-07-01T22:48:39.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2025-05-08T06:23:16.000Z (about 1 year ago)
- Last Synced: 2025-05-22T22:06:19.040Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://developer.nexmo.com/tutorials/private-sms-communication
- Size: 39.1 KB
- Stars: 4
- Watchers: 26
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SMS Proxy using Node and the Nexmo SMS API
This app uses the Nexmo SMS API to demonstrate how to build an SMS proxy for private communication between users. Each user sees only the other party's virtual number, not their real one.
## Prerequisites
You will need:
* A [free Nexmo account](https://dashboard.nexmo.com/sign-up)
* Somewhere to host this web app: Heroku or your local machine with ngrok both work well
## Installation
```sh
git clone https://github.com/nexmo/node-sms-proxy.git
cd node-sms-proxy
npm install
```
## Setup
Rename the config file:
```sh
mv example.env .env
```
Fill in the values in `.env` as appropriate; this will be your API key and secret, and the Nexmo number you want to use.
If you do not have a virtual number, you can purchase one via the [dashboard](https://dashboard.nexmo.com).
Configure the number's SMS webhook URL to point to your application (if you are using [ngrok](https://ngrok.com) then start your tunnel now), e.g. `https://abcd1234.ngrok.io/webhooks/inbound-sms`
### Running the App
```sh
npm start
```
The application should be available on `http://localhost:3000`.
> To change the port, try `PORT=3001 npm start` as an alternative command
### Using the App
Register a conversation with the application so that mappings can be created between real user numbers and Nexmo virtual numbers. This is done by making a `POST` such as the following to `http://localhost:3000/chat`
and replacing `USER_A_NUMBER` and `USER_B_NUMBER` with the real numbers of the parties involved:
```
POST /chat HTTP/1.1
Host: localhost:3000
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
userANumber=USER_A_NUMBER&userBNumber=USER_B_NUMBER
```
When you do this each of the users will receive a text. Replying to that text will allow the users to communicate anonymously with each other.