An NPM module to send physical mail or postcard with the Seeuletter.com API.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
lib
.gitignore
.npmignore
LICENSE.txt
README.md
package-lock.json
package.json

README.md

seeuletter-node

NPM version Dependency Status

Seeuletter.com Node.js Client is a simple but flexible wrapper for the Seeuletter.com API.

See full Seeuletter.com documentation here.

For best results, be sure that you're using the latest version of the Seeuletter 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.

Seeuletter 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.seeuletter.com/

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

Table of Contents

Getting Started

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

Please read through the official API Documentation to get a complete sense of what to expect from each endpoint.

Registration

First, you will need to first create an account at Seeuletter.com and obtain your Test and Live API Keys.

Once you have created an account, you can access your API Keys from the Settings Panel.

Installation

seeuletter-node can be installed through the npm:

$ npm install -S seeuletter

To build and install from the latest source:

$ git clone git@github.com:Seeuletter/seeuletter-node.git
$ npm install

Usage

Create a new letter - Callback style

var Seeuletter = require('seeuletter')('YOUR API KEY');

// callback pattern
Seeuletter.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 : 'Seeuletter'
  }
}, function (err, body) {
   if (err) console.log('err : ' , err.message);
   console.log('body : ', body)
})

Create a new letter - Promise style

var Seeuletter = require('seeuletter')('YOUR API KEY');

// promise pattern
Seeuletter.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 : 'Seeuletter'
  }
})
.then(function (response) {
  console.log('response : ', response);
})
.catch(function (err) {
  console.log('err : ', err);
});

Create a new postcard - Promise style

var Seeuletter = require('seeuletter')('YOUR API KEY');

// Create the address
Seeuletter.postcards.create({
  description: 'Test Postcard 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'
  },
  // https://www.seeuletter.com/templates
  source_file_front: 'Hy2GUkiyz',
  source_file_front_type: 'template_id',
  source_file_back: 'rkfnt1s1z',
  source_file_back_type: 'template_id',

  variables: {
    PRENOM: 'Erlich',
    NOM: 'Bachman',
    CODE_PROMO_BIENVENUE: 'CODE',
    URL_COURTE_BIENVENUE: 'https://goo.gl/uqTHnD',
    ADRESSE: '30 rue de Rivoli',
    CODE_POSTAL : '75004',
    VILLE : 'Paris',
    PAYS : 'France'
  }
})
  .then(function (letter) {
    console.log('The Seeuletter API responded : ', letter)
  })
  .catch(function (err) {
    console.log('Error message : ', err.message)
  })

List all Letters

var Seeuletter = require('seeuletter')('test_12345678901234567890')

Seeuletter.letters.list()
.then(function (response) {
  console.log('response : ', response);
})
.catch(function (err) {
  console.log('err : ', err);
});

Retrieve a specific Letter

var Seeuletter = require('seeuletter')('test_12345678901234567890')

Seeuletter.letters.retrieve('LETTER_ID')
.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.

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

Copyright © 2017 Seeuletter.com

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