<commit_before># lifebot-node


Lifebot.fr Node.js Client is a simple but flexible wrapper for the [Lifebot.fr](https://www.lifebot.fr) API. 

See full Lifebot.fr documentation [here](https://docs.lifebot.fr/). 

For best results, be sure that you're using the latest version of the Lifebot API and the latest version of the Node.js wrapper.

#### French
Un module NPM pour envoyer du courrier postal en ligne depuis votre application Node.Js.

Lifebot propose une API permettant d'envoyer très facilement du courrier postal depuis votre ERP, CRM ou application web.

Pas de frais d'installation. Pas d'engagement. Vous payez ce que vous consommez.

Documentation : https://docs.lifebot.fr/

Bien démarrer : https://www.lifebot.fr/guide/bien-demarrer-avec-l-api-d-envoi-de-courrier

## Table of Contents

- [Getting Started](#getting-started)
  - [Registration](#registration)
  - [Installation](#installation)
  - [Usage](#usage)
- [Examples](#examples)

## Getting Started

Here's a general overview of the Lifebot services available, click through to read more.


Please read through the official [API Documentation](https://docs.lifebot.fr/) to get a complete sense of what to expect from each endpoint.

### Registration

First, you will need to first create an account at [Lifebot.fr](https://www.lifebot.fr/signup) and obtain your Test and Live API Keys.

Once you have created an account, you can access your API Keys from the [Settings Panel](https://www.lifebot.fr/app/dashboard/keys).


### Installation

lifebot-node can be installed through the npm:

```
$ npm install lifebot
```

To build and install from the latest source:

```
$ git clone <EMAIL>:Lifebot-api/lifebot-node.git
$ npm install
```

### Usage

#### Callback
```javascript
var Lifebot = require('lifebot')('YOUR API KEY');


// callback pattern
Lifebot.letters.create({
  description: 'Test Letter from the Node.js Wrapper',
  to: {
    name: 'Erlich',
    address_line1: '30 rue de rivoli',
    address_line2: '',
    address_city: 'Paris',
    address_country: 'France',
    address_postalcode: '75004'
  },
  postage_type: 'prioritaire',
  color: 'bw',
  source_file: '<html>Hello, {{nom}}</html>',
  source_file_type: 'html',
  variables: {
    nom : 'Lifebot'
  }
}, function (err, body) {
   if (err) return callback(err);
   return callback(null, body.data);
})
```

#### Promise

```javascript

var Lifebot = require('lifebot')('YOUR API KEY');


// callback pattern
Lifebot.letters.create({
  description: 'Test Letter from the Node.js Wrapper',
  to: {
    name: 'Erlich',
    address_line1: '30 rue de rivoli',
    address_line2: '',
    address_city: 'Paris',
    address_country: 'France',
    address_postalcode: '75004'
  },
  postage_type: 'prioritaire',
  color: 'bw',
  source_file: '<html>Hello, {{nom}}</html>',
  source_file_type: 'html',
  variables: {
    nom : 'Lifebot'
  }
})
.then(function (response) {
  console.log(response.data);
})
.catch(function (err) {
  console.log(err);
});
```

## Examples

We've provided various examples for you to try out [here](https://github.com/lifebot-api/lifebot-node/tree/master/examples).


=======================

Copyright &copy; 2017 Lifebot.fr

Released under the MIT License, which can be found in the repository in `LICENSE.txt`.
<commit_msg>Fix console.log for usage examples<commit_after># lifebot-node


Lifebot.fr Node.js Client is a simple but flexible wrapper for the [Lifebot.fr](https://www.lifebot.fr) API. 

See full Lifebot.fr documentation [here](https://docs.lifebot.fr/). 

For best results, be sure that you're using the latest version of the Lifebot API and the latest version of the Node.js wrapper.

#### French
Un module NPM pour envoyer du courrier postal en ligne depuis votre application Node.Js.

Lifebot propose une API permettant d'envoyer très facilement du courrier postal depuis votre ERP, CRM ou application web.

Pas de frais d'installation. Pas d'engagement. Vous payez ce que vous consommez.

Documentation : https://docs.lifebot.fr/

Bien démarrer : https://www.lifebot.fr/guide/bien-demarrer-avec-l-api-d-envoi-de-courrier

## Table of Contents

- [Getting Started](#getting-started)
  - [Registration](#registration)
  - [Installation](#installation)
  - [Usage](#usage)
- [Examples](#examples)

## Getting Started

Here's a general overview of the Lifebot services available, click through to read more.


Please read through the official [API Documentation](https://docs.lifebot.fr/) to get a complete sense of what to expect from each endpoint.

### Registration

First, you will need to first create an account at [Lifebot.fr](https://www.lifebot.fr/signup) and obtain your Test and Live API Keys.

Once you have created an account, you can access your API Keys from the [Settings Panel](https://www.lifebot.fr/app/dashboard/keys).


### Installation

lifebot-node can be installed through the npm:

```
$ npm install lifebot
```

To build and install from the latest source:

```
$ git clone <EMAIL>:Lifebot-api/lifebot-node.git
$ npm install
```

### Usage

#### Callback
```javascript
var Lifebot = require('lifebot')('YOUR API KEY');


// callback pattern
Lifebot.letters.create({
  description: 'Test Letter from the Node.js Wrapper',
  to: {
    name: 'Erlich',
    address_line1: '30 rue de rivoli',
    address_line2: '',
    address_city: 'Paris',
    address_country: 'France',
    address_postalcode: '75004'
  },
  postage_type: 'prioritaire',
  color: 'bw',
  source_file: '<html>Hello, {{nom}}</html>',
  source_file_type: 'html',
  variables: {
    nom : 'Lifebot'
  }
}, function (err, body) {
   if (err) console.log('err : ' , err.message);
   console.log('body : ', body)
})
```

#### Promise

```javascript

var Lifebot = require('lifebot')('YOUR API KEY');


// callback pattern
Lifebot.letters.create({
  description: 'Test Letter from the Node.js Wrapper',
  to: {
    name: 'Erlich',
    address_line1: '30 rue de rivoli',
    address_line2: '',
    address_city: 'Paris',
    address_country: 'France',
    address_postalcode: '75004'
  },
  postage_type: 'prioritaire',
  color: 'bw',
  source_file: '<html>Hello, {{nom}}</html>',
  source_file_type: 'html',
  variables: {
    nom : 'Lifebot'
  }
})
.then(function (response) {
  console.log('response : ', response);
})
.catch(function (err) {
  console.log('err : ', err);
});
```

## Examples

We've provided various examples for you to try out [here](https://github.com/lifebot-api/lifebot-node/tree/master/examples).


=======================

Copyright &copy; 2017 Lifebot.fr

Released under the MIT License, which can be found in the repository in `LICENSE.txt`.

{'fraction_non_alphanumeric': 0.13952086786198584, 'fraction_numerical': 0.006629501280699111, 'mean_word_length': 4.133797370456303, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 16, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7070907', 'n_tokens_mistral': 2226, 'n_tokens_neox': 2089, 'n_words': 667}