# freemobile-sms

> Free mobile's sms API

Latest version **1.2.1** (published 2018-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install freemobile-sms
pnpm add freemobile-sms
yarn add freemobile-sms
bun add freemobile-sms
```

Provides the command `sms`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2018-03-17 |
| First published | 2017-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 9 |
| Author | Scotow |
| Maintainers | scotow |
| Keywords | free-mobile, sms, api, france |

## Links

- npm: https://www.npmjs.com/package/freemobile-sms
- Repository: https://github.com/Scotow/freemobile-sms
- Homepage: https://github.com/Scotow/freemobile-sms#readme
- Issues: https://github.com/Scotow/freemobile-sms/issues
- npm.io page: https://npm.io/package/freemobile-sms

## Dependencies (4)

- [yargs](https://npm.io/package/yargs.md) ^10.0.3
- [request](https://npm.io/package/request.md) ^2.81.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^5.0.0
- [request-promise-native](https://npm.io/package/request-promise-native.md) ^1.0.5

## Recent versions

- 1.2.1 (latest) — 2018-03-17
- 1.2.0 — 2018-03-17
- 1.1.0 — 2017-10-28

## README

# freemobile-sms

💬 **A simple [free-mobile](http://mobile.free.fr)'s sms API wrapper** 💬

A simple API and command line tools to send SMS using the Free Mobile 'notification' option.

### Prerequisites

This module was developed using [Node.js](http://nodejs.org) 8.9.X and was not tested with previous versions (even if it may work with previous releases).

### How to install

#### As a project module

`npm install -S freemobile-sms`

#### As a global package

`npm install -g freemobile-sms`

### Example

#### Using the library

*freemobile-sms* use [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) to make call to the API. Here is an example that send a SMS and display and error if something went wrong:

###### .send(message, credentials)
###### .send([message], credentials)

```js
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).
});
```

#### Using the built-in command

`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](https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback) to read the file.

`sms -c Hello World!`
> (Re)configure your credentials before sending the 'Hello World!' message.

### Credentials

Setup your credentials using one of the following methods:

- Run `sms -c` or `sms --config`

- Create a `credentials.json` file in the project's directory and fill it using the following pattern:

```JSON
{
	"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.*

### App

Head to this [link](https://mobile.free.fr/moncompte/index.php?page=options) to get your secret key. 🔑

### Disclaimer

*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.

---
_Source: https://npm.io/package/freemobile-sms · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
