The `postgrid-node-client` library provides a Node.js and TypeScript client for interacting with the PostGrid Business API, facilitating postal delivery services (Print-Mail) and address verification/autocomplete. Currently at version 0.11.0, this package offers a convenient, typed interface over PostGrid's dual REST API structure. A key differentiator is its robust handling of two distinct API keys required by PostGrid: one for Print-Mail and another for Address Verification, allowing developers to instantiate a single client that intelligently routes requests. While a specific release cadence isn't published, its pre-1.0 versioning implies active development. The client simplifies common tasks such as creating contacts, sending documents, and verifying addresses, abstracting away direct HTTP requests and JSON parsing, and supports webhook configuration for event notifications.
npm install postgrid-node-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate the PostGrid client with both Mail and Address Verification API keys (retrieved from environment variables) and then perform basic operations: creating a contact and verifying an address. It also shows optional webhook configuration.
Obtain both 'Mail API Key' from the Print-Mail Dashboard and 'Addr API Key' from the Address Verification Dashboard, and pass them correctly to the PostGrid constructor: `new PostGrid({ mail: mailKey, addr: addrKey })`.Use the object-based constructor `new PostGrid({ mail: '[Your Mail API Key]', addr: '[Your Addr API Key]' })` for full functionality and clarity, even if only using one service.Pin exact versions (e.g., `"postgrid-node-client": "0.11.0"`) or use tilde ranges (e.g., `"~0.11.0"`) rather than caret ranges (`"^0.11.0"`) to prevent unexpected breakage when new minor versions are released. Always review release notes when upgrading.
Ensure the `mail` property in the constructor object is set with your Print-Mail API key: `new PostGrid({ mail: 'YOUR_MAIL_API_KEY' })`.Use standard ES Module named import syntax: `import { PostGrid } from 'postgrid-node-client';` and ensure your Node.js project is configured for ESM (e.g., `"type": "module"` in `package.json`).Ensure the `addr` property in the constructor object is set with your Address Verification API key: `new PostGrid({ addr: 'YOUR_ADDR_API_KEY' })`.No dependency data recorded yet.