@quartz-insurance/postalserver-ts
v1.0.0
Published
TypeScript client for Postalserver.io
Readme
Postal Server client for TypeScript
Installation
yarn add @quartz-insurance/postal-ts
# or
npm install @quartz-insurance/postal-tsUsage
Import the client and types in your TypeScript application:
import { Postal, WebhookDto, WebhookEvent } from "@quartz-insurance/postal-ts";
// Initialize the client (supply your server URL and API key if needed)
const postal = new Postal({
host: "postal.yourdomain.com",
serverKey: "your_api_key_here",
});
// Example: Send an email
async function sendTestEmail() {
await postal.sendMessage({
to: "[email protected]",
from: "[email protected]",
subject: "Test message",
html: "<b>Hello world</b>"
});
}Webhook Typings
If you consume Postal webhooks in a TypeScript API:
import type { WebhookDto } from "@quartz-insurance/postal-ts";
// Your webhook handler
function handlePostalWebhook(data: WebhookDto) {
console.log("Event:", data.event);
// process event...
}Supported
- Typed API client for common Postal Server endpoints
- Type-safe webhook DTOs and events
For more, see the source code or raise an issue!
