Sincerely's Ship API for node.js AKA send postcards with JavaScript!
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


node-sincerely Version Badge

Node.js library to access Sincerely's Ship API.

Quick Start

npm install sincerely

Example Usage

var sincerely    = require('sincerely')('your-app-key')
  , path         = require('path')
  , fs           = require('fs')
  , Landscape6x4 = path.join(__dirname, 'Landscape6x4.jpg')
  , Portrait4x6  = path.join(__dirname, 'Portrait4x6.jpg');

// you could use the `async` module here to parallel
//  load a `frontPhotoId` and a `profilePhotoId`

// read the file as a base64 string
fs.readFile(Landscape6x4, function(err, data) {

  // check for errors while reading the file
  if (err) throw new Error(err);

  // upload an image asset so we can create a new postcard
    photo: new Buffer(data).toString('base64')
  }, function(err, response) {

    // check for errors while uploading the image
    if (err) return console.log(err);

    // create a new order and mail the postcard
        message: "These aren't the droids you're looking for."
      , frontPhotoId:
      , profilePhotoId:
      , recipients: [
              id: 12345
            , name: "Matt Brezina"
            , email: ""
            , company: "Sincerely, Inc."
            , street1: "800 Market St."
            , street2: "Floor 6"
            , city: "San Francisco"
            , state: "CA"
            , postalcode: "94102"
            , country: "United States"
      , sender: {
            name: "Nick Baugh"
          , email: ""
          , company: ""
          , street1: "123 Lettuce Lane"
          , street2: ""
          , city: "Sebastopol"
          , state: "CA"
          , postalcode: "95476-2222"
          , country: "United States"
    }, function(err, response) {

      // check for errors while creating the order
      if (err) return console.log(err);

      // output the response
      return console.log(response);





All methods take a data object as their first parameter and a callback(err, response) as their last parameter.

  • sincerely.create - Create a new order for the purposes of mailing a physical print and returns success or error.
  • sincerely.upload - Uploads an image asset and returns an id that can be used when calling sincerely.create.
  • sincerely.debug - Outputs a print preview PDF showing you what the final print will look like. Please note that this should be used for debug purposes only and should not be output to the end user.
  • sincerely.cancel - Cancel a print placed via the api before it ships. Prints are usually sent to production 2-4 hours from initial creation.

Documentation for these methods can be found at Sincerely's RESTful web api ("Ship API").


To run tests, install vows:

npm install vows

Then run:

SINCERELY=your-app-key vows test/*



MIT Licensed