neverbounce
Version:
An API wrapper for the NeverBounce API
29 lines (28 loc) • 876 B
JavaScript
import NeverBounce from '../src/NeverBounce.js';
import dotenv from 'dotenv';
// Load environment variables from .local.env file
dotenv.config();
// Initialize NeverBounce client with API key from environment variables
const client = new NeverBounce({
apiKey: process.env.NEVERBOUNCE_API_KEY
});
// Get account info
client.account.info()
.then((resp) => console.log('[THEN]', resp))
.catch((err) => console.log('[THEN] ERROR: ' + err.message));
// Alternative using async/await
async function getAccountInfo() {
try {
const info = await client.account.info();
console.log('[ASYNC] Account Info:', info);
}
catch (err) {
if (err instanceof Error) {
console.error('[ASYNC] Error:', err.message);
}
else {
console.error('[ASYNC] Unknown error occurred');
}
}
}
getAccountInfo();