Brevo Integration
Add or update a contact in Brevo (formerly Sendinblue) when a form is submitted.
Action type: brevo
Class: Core_Forms\Actions\Brevo
Source: src/actions/class-brevo.php
Setup
- In Brevo, go to SMTP & API under your account settings.
- Create or copy an API Key (v3).
- Note the List ID of the list you want to add contacts to (found under Contacts > Lists).
- In WordPress, edit your form > Actions tab > Add Action > Add to Brevo.
- Enter the API Key and List ID.
Settings Reference
| Setting | Required | Default | Description |
|---|---|---|---|
| API Key | Yes | -- | Brevo v3 API key |
| List ID | No | -- | Numeric list ID to add the contact to |
| Email Field | No | email |
Form field name containing the email address |
| Name Field | No | name |
Form field name containing the full name |
| Double Opt-in | No | Off | Send a confirmation email before subscribing |
Name Handling
The Name Field value is split on the first space:
- First word is stored as FIRSTNAME attribute
- Remaining words are stored as LASTNAME attribute
These are standard Brevo contact attributes.
Contact Deduplication
The API call uses updateEnabled: true, which means if a contact with the same email already exists, their attributes and list membership will be updated rather than creating a duplicate.
Double Opt-in
When enabled, the contact receives a confirmation email and is only added to the list after clicking the confirmation link. This requires a double opt-in template to be configured in your Brevo account.
How It Works
- Validates the API key and email address.
- Builds a contact payload with email, FIRSTNAME, LASTNAME, and updateEnabled flag.
- If a List ID is provided, includes it in the
listIdsarray. - POSTs to
https://api.brevo.com/v3/contactswith theapi-keyheader. - The request times out after 15 seconds.
- Returns
trueon success.
Example
Form with full_name and work_email fields:
- API Key:
xkeysib-your-api-key - List ID:
5 - Email Field:
work_email - Name Field:
full_name - Double Opt-in: checked
Troubleshooting
- Contact not added: Verify the API key is a v3 key. Older v2 keys are not compatible.
- List not found: List IDs are numeric. Check Contacts > Lists in Brevo for the correct ID.
- Double opt-in not working: Ensure you have a DOI template configured in Brevo settings.
- Invalid email: The action requires a valid email. It silently skips if the email field is empty or invalid.