DEV Community

Cover image for CF7 Brevo Integration Adds Contacts But Never Sends the Welcome Email - Here Is Why
Rahul Sharma
Rahul Sharma

Posted on

CF7 Brevo Integration Adds Contacts But Never Sends the Welcome Email - Here Is Why

A site owner posted on the WordPress support forums with a problem that was driving them crazy. Their CF7 form was connected to Brevo using CF7's built-in integration. Contacts were being added to the Brevo list perfectly after every form submission. But the welcome email was never being sent. Brevo support confirmed they were receiving no email send request at all from the website.

The CF7 plugin author suggested deactivating all plugins and switching to the default theme. On a live production site, that is not a realistic option. The thread was left unresolved.

The real reason this happens has nothing to do with plugin conflicts. It is a gap in what CF7's built-in Brevo integration actually does.

What CF7's Built-In Brevo Integration Actually Does

CF7 added native Brevo integration as a built-in feature. When you configure it and a form is submitted, CF7 makes an API call to Brevo to add the contact to your selected list.

That API call goes to Brevo's contacts endpoint:

POST https://api.brevo.com/v3/contacts
Enter fullscreen mode Exit fullscreen mode

This call creates or updates the contact in your Brevo account and adds them to the specified list. It works. The site owner confirmed contacts were appearing in Brevo correctly.

But sending a welcome email using a transactional template is a completely different operation. It requires a separate API call to Brevo's transactional email endpoint:

POST https://api.brevo.com/v3/smtp/email
Enter fullscreen mode Exit fullscreen mode

This second call does not happen. CF7's built-in Brevo integration only makes the contacts call. It does not make the transactional email call. There is no bug here. It is simply a feature that the built-in integration does not include.

Why the Welcome Email Option Exists But Does Not Work

CF7's Brevo settings panel includes a "Send a welcome email" checkbox. The existence of this option implies that checking it will send the welcome email. But based on Brevo's own confirmation that no email send request is reaching their servers, this option either does not trigger the transactional email API call or only works under specific conditions that are not documented.

The most likely explanation is that this setting was intended to work alongside Brevo's double opt-in confirmation email feature, not with a custom transactional template. Brevo has a built-in confirmation email mechanism tied to lists, which is separate from sending a transactional template with a specific template ID. The checkbox in CF7 may only activate the Brevo list-level confirmation email, not a custom template send.

How to Actually Send a Welcome Email After CF7 Submission

To send a welcome email using a specific Brevo transactional template after a CF7 submission, you need to make the second API call yourself. The cleanest way to do this is with a PHP function that hooks into CF7's submission event.

add_action('wpcf7_before_send_mail', 'send_brevo_welcome_email');

function send_brevo_welcome_email($contact_form) {
    if ((int) $contact_form->id() !== YOUR_FORM_ID) return;

    $submission = WPCF7_Submission::get_instance();
    if (!$submission) return;

    $data  = $submission->get_posted_data();
    $email = sanitize_email($data['your-email'] ?? '');
    $name  = sanitize_text_field($data['your-name'] ?? '');

    if (empty($email)) return;

    $api_key     = defined('BREVO_API_KEY') ? BREVO_API_KEY : '';
    $template_id = 12; // replace with your Brevo template ID

    $response = wp_remote_post('https://api.brevo.com/v3/smtp/email', [
        'headers' => [
            'api-key'      => $api_key,
            'Content-Type' => 'application/json',
        ],
        'body' => wp_json_encode([
            'templateId' => $template_id,
            'to'         => [['email' => $email, 'name' => $name]],
            'params'     => [
                'FIRSTNAME' => $name,
            ],
        ]),
        'timeout' => 15,
    ]);

    if (is_wp_error($response)) {
        error_log('[CF7->Brevo] Welcome email failed: ' . $response->get_error_message());
    }
}
Enter fullscreen mode Exit fullscreen mode

Add your API key to wp-config.php:

define('BREVO_API_KEY', 'your-brevo-api-key-here');
Enter fullscreen mode Exit fullscreen mode

Your template ID is the number that appears in Brevo under Email Templates when you open the template you want to use.

The params object lets you pass personalisation variables into your Brevo template. If your template uses {{ params.FIRSTNAME }}, the value you pass in params.FIRSTNAME will be substituted in.

The No-Code Option

If you do not want to manage PHP code, Contact Form to API lets you connect CF7 directly to Brevo's transactional email endpoint from the WordPress dashboard. You set the API endpoint, add your Brevo API key as the api-key header, configure the JSON body with your template ID and the CF7 fields mapped to the to and params values, and the welcome email fires automatically on every form submission.

This gives you the same result as the custom PHP approach without writing or maintaining any code. And because it calls the transactional email endpoint directly, you know the welcome email request is actually being sent to Brevo rather than silently not firing.

Quick Check: Is Your Template Actually Active?

Before assuming the integration is the problem, confirm one thing in Brevo. Go to Email Templates and open the template you want to use. Check that the status shows as Active. Brevo will not send emails for draft or inactive templates even if the API call reaches them. The site owner in the forum confirmed their template was active, but this is the first thing to verify if you are debugging this issue yourself.

Summary

CF7's built-in Brevo integration adds contacts successfully but does not make the separate API call needed to send a transactional welcome email. The "Send a welcome email" checkbox in CF7's settings does not trigger a transactional template send. To actually send a Brevo welcome email on CF7 form submission, you need either a custom PHP function that calls POST /v3/smtp/email or a plugin like Contact Form to API that handles that call from a configuration interface.

Top comments (0)