💬 A simple free-mobile's sms API wrapper 💬
A simple API and command line tools to send SMS using the Free Mobile 'notification' option.
This module was developed using Node.js 8.9.X and was not tested with previous versions (even if it may work with previous releases).
npm install -S freemobile-sms
npm install -g freemobile-sms
freemobile-sms use Promise to make call to the API. Here is an example that send a SMS and display and error if something went wrong:
const freemobile = require('freemobile-sms');
freemobile.send('Hello, World!', credentials)
.then(() => {
// Message(s) sent.
})
.catch(error => {
console.error('An error has occurred while sending the message.');
// An error has occurred, an Error is return if the credentials wasn't setup or if the message is incorrect.
// NB: Be careful to don't overuse the api because it has a daily limit (maybe 300 messages per day).
});
sms Hello World!
Send a SMS to your mobile phone with the 'Hello World!' text.
sms -s Hello World!
Handle each argument as a single message (send two messages 'Hello' and 'World!').
sms -f my_file.txt
Send the content of the 'my_file.txt' file.
sms -f my_file.txt -e ascii
Same as previous, but use ascii encoding to read the file.
sms -c Hello World!
(Re)configure your credentials before sending the 'Hello World!' message.
Setup your credentials using one of the following methods:
-
Run
sms -c
orsms --config
-
Create a
credentials.json
file in the project's directory and fill it using the following pattern:
{
"user": "YOUR_USER_ID",
"password": "YOUR_SECRET_KEY"
}
NB: If no credentials are set when running the sms
command, the credentials configuration process will be called automatically.
Head to this link to get your secret key. 🔑
freemobile-sms provided by Scotow is for illustrative purposes only which provides customers with programming information regarding the products. This software is supplied "AS IS" without any warranties and support.
I assumes no responsibility or liability for the use of the software, conveys no license or title under any patent, copyright, or mask work right to the product.