1.0.0 • Published 4 months ago
edith-sdk v1.0.0
EDITH - Email Service SDK
A TypeScript/JavaScript SDK for interacting with the Sparrow Email Service API.
Installation
npm install @sparroweng/edith
Usage
import { EdithClient } from "@sparroweng/edith";
// Initialize the client
const client = new EdithClient({
apiKey: "your-api-key-here",
// Optional: specify a different base path
// basePath: 'https://api.yourdomain.com'
});
// Send a simple email
await client.sendSimpleEmail({
from: "sender@example.com",
to: ["recipient@example.com"],
subject: "Hello from EDITH",
html: "<h1>Hello World</h1>",
text: "Hello World",
mailer_id: "your-mailer-id",
});
// Add a domain
await client.addDomain({
domain: "example.com",
});
// Configure SMTP
await client.configureSMTP({
name: "My SMTP Config",
config_type: "basic",
connection_type: "tls",
host: "smtp.example.com",
port: 587,
username: "smtp_user",
password: "smtp_password",
});
// Get SMTP configuration
const smtpConfig = await client.getSMTPConfig("your-mailer-id");
// Register a webhook
await client.registerWebhook({
url: "https://your-webhook-endpoint.com",
events: ["email.sent", "email.delivered", "email.failed"],
});
Features
- Send emails with HTML and plain text content
- Manage email domains
- Configure SMTP settings
- Configure IMAP settings
- Manage webhooks
- Handle inbound email routing
API Reference
Email Operations
sendSimpleEmail(payload: SimpleEmailPayload)
: Send an email with a simplified payloadsendEmail(payload: RequestmodelsEmailPayload)
: Send an email with full configuration options
Domain Operations
addDomain(payload: RequestmodelsDomainPayload)
: Add a new domaingetDomain(domain: string)
: Get domain detailsverifyDomain(domain: string)
: Verify a domaindeleteDomain(domain: string)
: Delete a domain
SMTP Operations
configureSMTP(payload: RequestmodelsCreateSMTPPayload)
: Configure SMTP settingsupdateSMTP(payload: RequestmodelsUpdateSMTPPayload)
: Update SMTP configurationgetSMTPConfig(mailerId: string)
: Get SMTP configurationdeleteSMTPConfig(mailerId: string)
: Delete SMTP configuration
IMAP Operations
configureIMAP(payload: RequestmodelsCreateIMAPPayload)
: Configure IMAP settingsupdateIMAP(payload: RequestmodelsUpdateIMAPPayload)
: Update IMAP configurationgetIMAPConfig(mailerId: string)
: Get IMAP configurationdeleteIMAPConfig(mailerId: string)
: Delete IMAP configuration
Webhook Operations
registerWebhook(payload: RequestmodelsWebhookCreatePayload)
: Register a webhookupdateWebhook(payload: RequestmodelsWebhookUpdatePayload)
: Update webhook settingsdeleteWebhook(payload: RequestmodelsWebhookDeletePayload)
: Delete a webhook
Inbound Email Operations
configureInboundRouting(payload: RequestmodelsIncomingDomainPayload)
: Configure inbound email routingupdateInboundDomain(domain: string, payload: RequestmodelsUpdateIncomingDomainPayload)
: Update inbound domain configuration
Development
# Install dependencies
npm install
# Generate API types from swagger.json
npm run generate
# Build the SDK
npm run build
# Run the example
npm run test:example
License
ISC
Support
For support, please open an issue in the GitHub repository.
1.0.0
4 months ago