Home

Awesome

TextBelt Open Source

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.

This project uses carrier-specific gateways to deliver your text messages for free, and without ads. The service is fairly reliable when configured on a private server and has sent over 1 million texts.

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.

If you are using the paid version at https://textbelt.com, run the following (more examples available on the homepage):

$ curl -X POST https://textbelt.com/text \
   -d number=5551234567 \
   -d "message=I sent this message for free with Textbelt" \
   -d key=abcdef123456

Success and Failure

Sample success:

{"success":true}

Note that success means that the message was sent to Textbelt's list of providers. We can't guarantee delivery on your network.

Sample failure:

{"success":false,"message":"Exceeded quota for this phone number."}

Usage as a module

Though this repository contains an express server so you may run your own instance of the web app, you may also use it to send text messages in your project.

Configuration:

This project uses nodemailer for sending emails. Set up lib/config.js with the following:

A sample transport with SMTP sending is included.

For example, to send a text using the default settings:

var text = require('textbelt');

text.send('9491234567', 'A sample text message!', undefined, function(err) {
  if (err) {
    console.log(err);
  }
});

You can also supply a region (valid choices are us, intl, or canada)

var text = require('textbelt');

// Canada
text.send('9491234567', 'A sample text message!', 'canada', function(err) {
...
});

// International
text.send('1119491234567', 'Bonjour!', 'intl', function(err) {
...
});

Usage as a standalone server

Textbelt can be run as a standalone server with: node server/app.js. Be sure to install dependencies first with npm install and you've configured nodemailer in lib/config.js. This project also relies on redis. To install redis locally, please see the redis documentation. Before launching the app, ensure redis is running on port 6379 with redis-server.

By default, the server listens on port 9090.

Don't forget to set fromAddress in lib/config.js to the email address you want to send from.

Canadian and International endpoints

The /text endpoint supports U.S. phone numbers (and parts of Canada).

For Canadian texts, curl http://textbelt.com/canada.

For international texts, curl http://textbelt.com/intl.

Canadian and international support may not be complete. Refer to the list of supported carriers.

Textbelt Clients

Notes and Limitations

License (MIT)

TextBelt Copyright (C) 2018 by Ian Webster

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.