From b33d31a1e2023dd46c1ef4ed5839a8c4c970b84a Mon Sep 17 00:00:00 2001 From: Taylor Russ Date: Sun, 5 Oct 2014 22:55:58 -0700 Subject: [PATCH] Update README with module use info. --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index d3ed7a7..0443f9e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,38 @@ 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. The only requirement is unix/posix `sendmail`, used to forward the message. + +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) { +... +}); + ``` ### Canadian and International endpoints