Brevo Functions

Define a custom formula to calculate contact attributes
View as Markdown

Closed beta. Brevo Functions is rolling out gradually. If your account doesn’t have access yet, join the waitlist below and we’ll notify you.

Join the waitlist

A Brevo Function is a serverless function, running on Brevo’s infrastructure, that calculates a contact attribute — write the formula yourself, generate it with AI, or start from a predefined template.

Create a Brevo Function app

Brevo Functions live inside a Brevo Function app — one of the app types offered by brevo app create:

brevo app create

The prompts walk you through:

  1. Distribution type: Brevo Function apps must be private.
  2. App type: choose Brevo Function.

This writes a project directory with an app-config.json. For a Function app it looks like this:

{
"app_id": "e22eb778-a2a8-488a-a5e8-466b6dad9385",
"app_name": "my-functions",
"version": "1",
"logo_uri": "",
"distribution_type": "private",
"app_type": "function",
"brevo_function": {}
}

brevo_function: {} is a static marker that identifies the app type — there’s nothing to edit inside it. A Function app has no auth block and no ui_app block. Functions themselves are created and deployed with brevo fn, not by editing this file.

Create your first function

brevo fn init

brevo fn is the short alias for brevo function — every command in this guide works either way, for example brevo fn init or brevo function init.

The command is interactive only (it needs a terminal to prompt in) and walks you through:

  1. Pick the app — if you have more than one Brevo Function app, choose which one this function belongs to.
  2. Choose how to create it:
    • Generate using AI — describe what the function should do in a sentence, and the CLI generates it for you, working through a few stages (analyzing the request, contacting databases, creating the function, testing the function).
    • Use a predefined template — pick from the templates available in your account.
  3. Preview — before anything is named or activated, the CLI fetches sample contacts from your account and shows a preview table of what the function would return for them.
  4. Iterate (AI path only) — from the preview, choose Update / iterate on the prompt to describe changes and preview again, or Deploy once you’re happy with the result.
  5. Name it — names must be unique across your Brevo Functions.
  6. Confirm deploy — the CLI warns “This will activate the function and run it with real-time data” before the final confirmation. Confirming activates the function immediately and prints its ID.

If you stop before deploying, nothing is lost — see Working with drafts below.

Working with drafts

A function you’re generating or previewing, but haven’t deployed yet, is a draft. Drafts expire, so don’t leave one unfinished for too long.

brevo fn list --draft

To pick a draft back up and deploy it — including linking it to a Brevo Function app — use:

brevo fn deploy --id <draft-id>

This runs the same sample-contact preview, naming, and deploy confirmation as brevo fn init.

Manage your functions

Every brevo fn command supports --json for machine-readable output.

CommandDescription
brevo fn listList the functions in your account (or just drafts, with --draft)
brevo fn getShow one function’s details — status, description, formula
brevo fn activateTurn a deactivated function back on
brevo fn deactivateTurn a function off without deleting it
brevo fn deletePermanently delete a deployed function

See the CLI reference for the full flag list on every command above.

Join the waitlist

Want to be notified when Brevo Functions ships to your account? Leave your details below.