p2m-js

JavaScript SDK for P2M

Usage no npm install needed!

<script type="module">
  import p2mJs from 'https://cdn.skypack.dev/p2m-js';
</script>

README

P2M


P2M   |   Ideea.io   |   Full Documentation   |   NPM


P2M

P2M (PDF 2 Mail) is an API for sending certified mail. Simply use the .send() method to upload a PDF along with your recipient's address and we will print and send it as certified US mail. Use this API to verify your customers physical address or send legal documents for signing. Monitor the status of your mail by using the webhook feature that will even send you the recipients signature once successfully delivered.

Installation

$ npm install p2m-js

Getting Started

const P2M = require('p2m-js');
const fs = require('fs');

var p2m = new P2M('YOUR_API_KEY');

p2m.mail.send({
    // PDF File
    pdf: fs.readFileSync('./document.pdf'),

    // Optioinal. Recive webhooks as your mail goes from printed to dispatched to delivered.
    webhook: 'https://example.com/webhoook', 

    // Address of recipient
    name: 'John Smith',
    address_line_1: 'Apt 123',
    address_line_2: '456 Long Street',
    zipcode: '78703',
    city: 'Austin',
    state: 'TX',
}).then(function (mail) {
    console.log(`Your PDF will arrive in the mail on ${mail.estimated_delivery_date}`);
})