Skip to main content
Technology & EngineeringEmail Services204 lines

Brevo

Send transactional and marketing email with Brevo (formerly Sendinblue). Use this

Quick Summary26 lines
You are an email operations specialist who integrates Brevo into projects. Brevo
is a multi-channel marketing and transactional platform (formerly Sendinblue) that
combines email, SMS, WhatsApp, CRM, and automation in one platform.

## Key Points

1. **Entry point**: API event, contact attribute change, or date trigger
2. **Conditions**: Branch based on contact attributes or behavior
3. **Actions**: Send email, SMS, WhatsApp, update contact, webhook
4. **Delays**: Wait a specific duration or until a condition is met
- Use contact attributes for personalization — they persist across all campaigns
- Segment contacts by attributes and engagement for targeted campaigns
- Use templates for all recurring emails — manage content in Brevo dashboard
- Separate transactional sends from marketing campaigns
- Use automation workflows for multi-step sequences (welcome, onboarding, retention)
- Monitor deliverability statistics in Brevo's dashboard
- Use double opt-in for marketing lists
- Using transactional API for bulk marketing sends

## Quick Example

```bash
npm install @getbrevo/brevo
```
skilldb get email-services-skills/BrevoFull skill: 204 lines
Paste into your CLAUDE.md or agent config

Brevo Email Integration

You are an email operations specialist who integrates Brevo into projects. Brevo is a multi-channel marketing and transactional platform (formerly Sendinblue) that combines email, SMS, WhatsApp, CRM, and automation in one platform.

Core Philosophy

Multi-channel from one platform

Brevo's strength is combining email, SMS, and WhatsApp in a single API and automation builder. If your project needs multiple channels, Brevo eliminates the need for separate providers.

Contacts are CRM records

Brevo treats every contact as a CRM record with attributes, lists, segments, and engagement history. Design your integration around contact attributes — they power segmentation, personalization, and automation.

Automation replaces manual campaigns

Build automation workflows visually in Brevo's dashboard. Application code triggers entry points, and the workflow handles timing, branching, and multi-step sequences.

Setup

Install

npm install @getbrevo/brevo

Initialize

import * as brevo from '@getbrevo/brevo';

const apiInstance = new brevo.TransactionalEmailsApi();
apiInstance.setApiKey(
  brevo.TransactionalEmailsApiApiKeys.apiKey,
  process.env.BREVO_API_KEY
);

Key Techniques

Transactional send

const sendSmtpEmail = new brevo.SendSmtpEmail();
sendSmtpEmail.to = [{ email: 'user@example.com', name: 'Alice' }];
sendSmtpEmail.sender = { email: 'noreply@yourdomain.com', name: 'App' };
sendSmtpEmail.subject = 'Your password reset link';
sendSmtpEmail.htmlContent = '<p>Click <a href="...">here</a> to reset.</p>';
sendSmtpEmail.textContent = 'Reset: https://...';
sendSmtpEmail.tags = ['security', 'password_reset'];
sendSmtpEmail.params = { userId: '123' };

await apiInstance.sendTransacEmail(sendSmtpEmail);

Template send

Create templates in Brevo's dashboard with {{ params.variable }} syntax.

const sendSmtpEmail = new brevo.SendSmtpEmail();
sendSmtpEmail.to = [{ email: 'user@example.com' }];
sendSmtpEmail.templateId = 1;
sendSmtpEmail.params = {
  name: 'Alice',
  resetUrl: 'https://...',
  expiresIn: '1 hour',
};

await apiInstance.sendTransacEmail(sendSmtpEmail);

Contact management

const contactsApi = new brevo.ContactsApi();
contactsApi.setApiKey(brevo.ContactsApiApiKeys.apiKey, process.env.BREVO_API_KEY);

// Create contact
await contactsApi.createContact({
  email: 'user@example.com',
  attributes: {
    FIRSTNAME: 'Alice',
    PLAN: 'pro',
    SIGNUP_DATE: '2025-01-15',
  },
  listIds: [1], // Add to list
});

// Update contact attributes
await contactsApi.updateContact('user@example.com', {
  attributes: { PLAN: 'enterprise' },
});

Campaign creation

const campaignsApi = new brevo.EmailCampaignsApi();
campaignsApi.setApiKey(brevo.EmailCampaignsApiApiKeys.apiKey, process.env.BREVO_API_KEY);

const campaign = await campaignsApi.createEmailCampaign({
  name: 'March Newsletter',
  subject: 'What shipped this month',
  sender: { email: 'updates@yourdomain.com', name: 'Updates' },
  htmlContent: newsletterHtml,
  recipients: { listIds: [1] },
  scheduledAt: '2025-03-15T09:00:00Z',
});

SMS sending

const smsApi = new brevo.TransactionalSMSApi();
smsApi.setApiKey(brevo.TransactionalSMSApiApiKeys.apiKey, process.env.BREVO_API_KEY);

await smsApi.sendTransacSms({
  sender: 'App',
  recipient: '+1234567890',
  content: 'Your verification code: 123456',
  tag: 'otp',
});

Webhook Processing

EventAction
deliveredMark delivered
hardBounceSuppress address permanently
softBounceLog, monitor
complaintSuppress from marketing
unsubscribedUpdate subscription state
openedUpdate engagement
clickedUpdate engagement
export async function POST(req: Request) {
  const body = await req.json();
  const { event, email } = body;

  switch (event) {
    case 'hardBounce':
      await suppressAddress(email, 'hard_bounce');
      break;
    case 'complaint':
      await suppressAddress(email, 'complaint');
      break;
    case 'unsubscribed':
      await updateSubscription(email, false);
      break;
  }

  return new Response('OK');
}

Automation Workflows

Build automations in Brevo's visual workflow builder:

  1. Entry point: API event, contact attribute change, or date trigger
  2. Conditions: Branch based on contact attributes or behavior
  3. Actions: Send email, SMS, WhatsApp, update contact, webhook
  4. Delays: Wait a specific duration or until a condition is met

Trigger automation entry from code:

// Fire a custom event that starts an automation
await apiInstance.sendTransacEmail({
  to: [{ email: 'user@example.com' }],
  templateId: 5, // Automation trigger template
  params: { event_type: 'trial_started', plan: 'pro' },
  tags: ['automation_trigger'],
});

Best Practices

  • Use contact attributes for personalization — they persist across all campaigns
  • Segment contacts by attributes and engagement for targeted campaigns
  • Use templates for all recurring emails — manage content in Brevo dashboard
  • Separate transactional sends from marketing campaigns
  • Use automation workflows for multi-step sequences (welcome, onboarding, retention)
  • Monitor deliverability statistics in Brevo's dashboard
  • Use double opt-in for marketing lists

Anti-Patterns

  • Using transactional API for bulk marketing sends
  • Not setting contact attributes — limits segmentation and personalization
  • Building automation logic in code instead of Brevo's workflow builder
  • Ignoring hard bounce events — damages sender reputation
  • Sending to unsubscribed contacts — violates compliance and Brevo TOS
  • Not configuring domain authentication (SPF, DKIM, DMARC)

Install this skill directly: skilldb add email-services-skills

Get CLI access →