Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
/ trailpack-lob Public archive

📦 Trailpack to send physical mail with [Lob API](https://lob.com)

License

Notifications You must be signed in to change notification settings

jaumard/trailpack-lob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trailpack-lob

NPM version Build status Dependency Status Code Climate Beerpay Beerpay

Trailpack to send physical mail with Lob API

Install

With yo:

$ yo trails:trailpack trailpack-lob

With npm:

$ npm install --save trailpack-lob

Configure

// config/main.js
module.exports = {
  packs: [
    // ... other trailpacks
    require('trailpack-lob')
  ]
}
// config/lob.js
module.exports = {
  apiKey: 'Your API key',
  /**
   * Options to pass during lob initialisation
   * @see https://github.com/lob/lob-node#options
   */
  options: {},

  /**
   * From address used to send letters
   * Can be an object or an ID
   */
  from: {
    name: 'Person',
    address_line1: '123 Test',
    address_line2: 'Unit 200',
    address_city: 'Chicago',
    address_state: 'IL',
    address_zip: '60012',
    address_country: 'US'
  }
}

Usage

Native usage of lob API :

  this.app.packs.lob.api.letters.create({
     description: 'My First Letter',
     to: {
        name: 'Test Person',
        address_line1: '123 Test Street',
        address_line2: 'Unit 200',
        address_city: 'Chicago',
        address_state: 'IL',
        address_zip: '60012',
        address_country: 'US'
      },
     from: {
       name: 'Test Person',
       address_line1: '123 Test Street',
       address_line2: 'Unit 200',
       address_city: 'Chicago',
       address_state: 'IL',
       address_zip: '60012',
       address_country: 'US'
     },
     file: '<html>...</html>',
     data: {
       name: 'Robin'
     },
     color: false
   }).then(letter => {...})

Usage with the Trails service:

this.app.services.LobService.sendLetter(to, file, data, more).then(letter => {...}) 

this.app.services.LobService.sendPostcard(to, front, back, data, more).then(postcard => {...}) 

License

MIT

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay

About

📦 Trailpack to send physical mail with [Lob API](https://lob.com)

Resources

License

Stars

Watchers

Forks

Packages

No packages published