-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
📧 Problems Sending Emails via Brevo (@getbrevo/brevo) in TypeScript
Description
I am unable to send transactional emails using Brevo's (@getbrevo/brevo / sib-api-v3-typescript) packages in my TypeScript project. I have tried multiple approaches (CommonJS, ESModules, named imports, default imports) but always run into type errors or import issues. Even the basic import { TransactionalEmailsApi } from '@getbrevo/brevo' statement doesn’t compile.
I haven't found any working example or clear documentation for TypeScript that resolves these issues.
Reproduction Steps
- Install package
npm install @getbrevo/brevo # or: npm install sib-api-v3-typescript - Create
services/email.tsimport { TransactionalEmailsApi, SendSmtpEmail } from '@getbrevo/brevo'; const client = new TransactionalEmailsApi();
- Compile/Run
tsc # or: ts-node services/email.ts
Actual Behavior
- TypeScript Errors:
TS2305: Module '"@getbrevo/brevo"' has no exported member 'TransactionalEmailsApi'. OR TS1192: Module '"@getbrevo/brevo"' has no default export.
- Import Failures at runtime:
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.
Expected Behavior
- Successful compilation of TypeScript files that import Brevo’s client classes.
- Runtime ability to send transactional emails via
client.sendTransacEmail(...)without errors.
Environment
- Node.js: v22.14.x
- TypeScript: v5.5.x
- @getbrevo/brevo: v2.2.x
- sib-api-v3-sdk: v3.13.x (if tested)
- OS: macOS/Linux/Windows 10
Attempts & Notes
- Tried both CommonJS (
require('@getbrevo/brevo')) and ESModule (import ... from '@getbrevo/brevo'). - Verified
node --experimental-modulesbut still facedERR_REQUIRE_ESM. - Checked package.json
"type": "module"and removed it, but then lost ES import support. - Looked at
dist/index.jsin@getbrevo/brevo—it seems to be ESM but type declarations mismatch. - No clear examples in the official docs for TypeScript.
Thank you! Let me know if any additional details or logs would help.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
