TextBelt Open Source is a REST API that sends outgoing SMS. It uses a free mechanism for sending texts, different from the more reliable paid version available at https://textbelt.com.
Send a text with a simple POST request:
$ curl -X POST http://my_textbelt_server/text \
-d number=5551234567 \
-d "message=I sent this message for free with Textbelt"number and message parameters are required.
first, clone this repo. then...
# 1. install dependencies
npm install # for reference, i used node 16.17.0
# 2. config your email inside lib/config.js (note the Gmail defaults and password instructions)
# 3. run the server
redis-server # should default to port 6379
node server/app.js # (new terminal tab)
# 4. send yourself a text message
curl -X GET http://localhost:9090/text \
-d number=<your-cell-phone> \
-d "message=I sent this message for free with Textbelt"
you may prefer to change your Gmail credentials (step 2) to environment variables before pushing this code to a private repo on your own GitHub account.
git add .
git commit -m 'prepare textbelt for deploy'
git remote set-url origin https://github.com/yourusername/your_new_repo
- create a free Render.com account. this is basically like Heroku.
- make a "Web Service" from your dashboard or click New > Web Service from navigation
- auth your GitHub and select the textbelt repository you created
- name your app, e.g.
textbelt, then set Environment toNode, Build Command tonpm install, and Start Command tonode server/app.js - select the free Instance Type
- if you refactored
lib/config.jsto use environment variables, plug those in by clicking Advanced > Add Environment Variable - click Create Web Service
this will build and deploy your code. when it's done, click the URL generated by Render and you should see the "homepage" saying I'm online!.
finally, test your live server:
curl -X GET https://your-textbelt-server.onrender.com/text \
-d number="your-cell-phone" \
-d "message=A free text message with Textbelt on Render"enjoy! and huge thanks to Ian Webster for creating TextBelt.