# free-text-api

> Collection of apis and libraries that allow to add free texting to any service

Latest version **1.4.0** (published 2019-06-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install free-text-api
pnpm add free-text-api
yarn add free-text-api
bun add free-text-api
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2019-06-28 |
| First published | 2018-09-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 (+24 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Niles Tanner |
| Maintainers | nilestanner |

## Links

- npm: https://www.npmjs.com/package/free-text-api
- Repository: https://github.com/nilestanner/free-text-api
- Homepage: https://github.com/nilestanner/free-text-api#readme
- Issues: https://github.com/nilestanner/free-text-api/issues
- npm.io page: https://npm.io/package/free-text-api

## Dependencies (4)

- [request](https://npm.io/package/request.md) ^2.88.0
- [nodemailer](https://npm.io/package/nodemailer.md) ^4.6.8
- [node-input-validator](https://npm.io/package/node-input-validator.md) ^2.3.1
- [nodemailer-sendgrid-transport](https://npm.io/package/nodemailer-sendgrid-transport.md) ^0.2.0

## Recent versions

- 1.4.0 (latest) — 2019-06-28
- 1.3.1 — 2019-05-10
- 1.3.0 — 2019-05-10
- 1.2.0 — 2018-10-07
- 1.1.0 — 2018-10-03
- 1.0.1 — 2018-09-29

## README

#Free text API
Ever wanted to send texts from your application but didn't want to pay for services like Twilio? This library's goal was to provide a way to do just that!

## Installation 
```
npm install free-text-api
```

## How does it work?

This is all possible because many major cell phone carriers allow users to send emails to phone numbers! The library will do all of the sorting and what not for you, however you will need to provide some configuration.

## Carrier look ups (optional)

You can go without this configuration if you already know the carrier for the number you are sending to.

Otherwise you can sign up for one of the following supported APIs:

* [NumVerify](https://numverify.com/)
* [Whitepages](https://pro.whitepages.com/)

Whitepages seems to be more reliable in determining the carrier.

## Outbound emails

Next you will need to add a emailing service to your application. 

* [Ethereal](https://ethereal.email/) (use for testing. Messages will not actually send)
* [Sendgrid](https://app.sendgrid.com/guide/integrate/langs/smtp)

## Some sample code

* [Express/ NodeJS example](https://github.com/nilestanner/free-text-api-nodejs)

```
const freeTextAPI = require('free-text-api');

const textService = freeTextAPI({
    carrierLookup: { // this should include all the nessisary configurations for your carrier lookup
        method: 'numverify', // 'numberify' or 'whitepages'
        apiKey: '####',
        defaultCountry: 'US'
    },
    mailOptions: { // this is optional, but if you go without you must provide a from when sending a text!
        from: 'noreply@freetexter.com'
    },
    transport: { // I have provided an exmaple for sendgrid, however this object can be formatted as any valid transport config object for nodeMailer
        service: 'SendGrid',
        auth: {
            user: 'user',
            pass: '****'
        }
    }
});

textService.sendText({
    number: 1234567890, // 10-digit phone number
    message:'Hello from the text service', // message no longer than 140 characters
    carrier:'Verizon', // optional, carrier name case-insensitive
    from: 'test@test.com' // optional, from email address (email format works best)
}).then((result) => {
    console.log(result);
});
```

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