Sendinblue

Integrating Sendinblue with Strapi? It's quite easy, and you'll reap numerous benefits, as well.

Sendinblue logo

Introduction to Sendinblue and Strapi

Sendinblue is an email marketing and transactional email service offering tools for email campaigns, automation, and sending transactional emails. With features like templates and contact management, it helps improve email communication.

By integrating Sendinblue with Strapi, you can manage your content and email services from a single application, streamlining processes like sending confirmation emails, newsletters, and automated messages directly from your Strapi backend.

Why Use Strapi with Sendinblue

Achieve Reliable Email Delivery

Sendinblue is a popular choice for email services and can be used as an alternative to Strapi's default email provider.

Benefit from a Generous Free Tier

Sendinblue's free plan lets you send up to 300 emails per day, which is beneficial for starting out or moderate email needs.

Ensure Seamless Integration

Sendinblue works well with Strapi, even when using Docker Compose with Strapi or scaling Strapi applications in Docker containers, ensuring consistent email functionality across environments.

Enhance Email Marketing with Advanced Features

Manage email marketing campaigns directly from Strapi, leveraging the latest Strapi updates. Features like contact lists, automation workflows, and templates help you engage your audience effectively. Additionally, adopting an API-first approach in Strapi facilitates seamless integration with Sendinblue. Strapi's multilingual capabilities also enable you to tailor your email communications to a global audience.

Implement Automated Workflows

Automate transactional emails like registration confirmations and password resets, saving time and ensuring timely communication.

Boost User Engagement

Synchronizing user data between Strapi and Sendinblue enables personalized email interactions, enhancing user engagement.

Key Features of Sendinblue

Send Transactional Emails

Send transactional emails directly from Strapi, essential for registration confirmations, password resets, and other automated emails.

Manage Email Marketing Campaigns

Manage and automate email marketing campaigns, including newsletters and promotional emails, and improve onboarding with Strapi using automation workflows for targeted marketing.

Utilize SMTP Relay and API Integration

Sendinblue offers SMTP relay and API access. Integrate with Strapi using plugins or directly call the API for greater control over email processes.

Use Email Templates

Utilize Sendinblue's email templates for consistent and professional designs, easily integrated into Strapi to standardize communications.

Manage Contacts

Add or update contacts while sending emails, keeping lists updated and allowing personalized messaging based on contact attributes.

Streamline Processes with Automation Workflows

Use automation workflows to streamline email marketing strategies, triggering emails based on user actions or predefined conditions.

Enhance Email Deliverability

Sendinblue enhances email deliverability compared to default providers, avoiding blocking by major servers like Gmail, Outlook, and Yahoo.

Best Practices for Integrating Sendinblue With Strapi

Store API Keys in Environment Variables

Secure your Sendinblue credentials by using environment variables, allowing easy configuration across environments.

Implement Comprehensive Error Handling

Handle errors gracefully with try-catch blocks to manage exceptions and logging for diagnosing issues, maintaining reliable communication.

Use Sendinblue Email Templates

Use Sendinblue's templating system for consistent designs, managing content directly from Sendinblue without changing application code.

Use Advanced Features

Integrate Sendinblue's contact management, segmentation, and automation workflows to enhance marketing strategies and personalize user experiences. Additionally, consider adding external databases in Strapi to store and manage extensive contact information or campaign data.

Secure Your Email Endpoints

Ensure email endpoints are secured with authentication and rate limiting to prevent unauthorized use and potential abuse.

Test Thoroughly Before Deployment

Before deploying Strapi on Vercel or deploying Strapi on AWS, test your integration in a development environment to identify and resolve issues, ensuring emails are sent correctly and all features function as expected.

Getting Started With Sendinblue

Integrating Sendinblue with Strapi enables you to send emails directly from your application.

Install the Sendinblue Email Provider

First, install the Sendinblue email provider for Strapi by checking the correct package name in the Strapi Marketplace or official sources, and use the typical npm command format:

npm install @strapi/provider-email-\[provider-name\] --save

Update your package.json to include the following dependency for installing from GitHub:

"dependencies": {

  "strapi-provider-email-sendinblue": "github:yanotoma/strapi-provider-email-sendinblue#<version>"

}

Replace with the actual version number.

Configure the Email Plugin

Create or update the config/plugins.js file in your Strapi project with the following setup for the Sendinblue email provider:

module.exports = ({ env }) => ({

  email: {

    provider: 'sendinblue',

    providerOptions: {

      apiKey: env('SENDINBLUE_API_KEY'),

    },

    settings: {

      defaultFrom: '[youremail@example.com](mailto:youremail@example.com)',

      defaultFromName: 'Your Name',

      defaultReplyTo: '[youremail@example.com](mailto:youremail@example.com)',

    },

  },

});

To set your Sendinblue API key, consult the official documentation for the correct variable name and usage in the .env file.

Send Emails with Strapi

After configuring the provider, you can send emails using Strapi's email service.

Send a Basic Email

await strapi.plugins\['email'\].[services.email](http://services.email).send({

  to: '[recipient@example.com](mailto:recipient@example.com)',

  subject: 'Welcome!',

  html: '<h1>Hello!</h1><p>Thanks for joining us.</p>',

  text: 'Hello! Thanks for joining us.',

  tags: \['welcome', 'new-user'\],

});

Use Sendinblue Templates

To use templates in Sendinblue with Strapi's email plugin, consider general methods for sending emails with templates. Consult the documentation for guidance on using Lodash for handling templates, as specific instructions for Sendinblue templates and parameters are not detailed.

Manage Contacts

Add or update contacts in Sendinblue lists while sending emails:

const contact = {

  email: '[newuser@example.com](mailto:newuser@example.com)',

  attributes: {

    FIRSTNAME: 'New',

    LASTNAME: 'User',

  },

};

await strapi.plugins\['email'\].[services.email](http://services.email).send({

  to: [contact.email](http://contact.email),

  subject: 'Welcome!',

  html: \`<h1>Hello ${contact.attributes.FIRSTNAME}</h1>\`,

  text: \`Hello ${contact.attributes.FIRSTNAME}\`,

  tags: \['welcome'\],

  contact, // Intended to add or update the contact in Sendinblue

});

Use Nodemailer with Sendinblue SMTP: An Alternative Method

To use Sendinblue's SMTP with the Nodemailer provider in Strapi, you can install the Nodemailer provider, configure it in config/plugins.js, and set up the necessary environment variables.

Create Custom Email Routes

To manage specific email actions like newsletter subscriptions, consider setting up custom routes. Start by defining a new route in api/contact/config/routes.json. Then, create the corresponding controller in api/contact/controllers/Contact.js. If needed, install the Sendinblue SDK with npm install sib-api-v3-sdk and include your Sendinblue API key in the .env file.

To make a route publicly accessible in Strapi, adjust the route's auth configuration parameter to false, allowing access without using Strapi's authentication system.

Tips for a Smooth Integration

  • Use Environment Variables: Keep sensitive data like API keys in environment variables to enhance security.
  • Test Thoroughly Before Deployment: Before deploying Strapi on Vercel or deploying Strapi on AWS, test your integration in a development environment to identify and resolve issues, ensuring emails are sent correctly and all features function as expected.
  • Handle Errors Gracefully: Implement error handling to manage failed email sends and provide feedback.

Frequently Asked Questions

Install the Sendinblue provider plugin, configure your API key in Strapi's plugins configuration, and set sender details. Sendinblue handles both transactional and marketing emails from a single platform.

Sendinblue's free plan includes 300 emails per day, which covers most development and small production needs. Upgrade for higher volumes, advanced automation, and dedicated IP addresses.

Yes, create email templates in Sendinblue's drag-and-drop builder, then trigger these templates from Strapi using the template ID. Pass dynamic content from Strapi to personalize each email.

Sync contact data from Strapi to Sendinblue lists, then build automation workflows in Sendinblue. Trigger workflows based on Strapi events like user registration or content publication.

Yes, Sendinblue offers SMS capabilities through the same API. Extend your Strapi integration to send SMS notifications for time-sensitive content or user communications.