Brevo

Learn how to use Brevo with Composio

Overview

SLUG: BREVO

Description

Brevo (formerly Sendinblue) is an all-in-one email and SMS marketing platform that provides transactional messaging, marketing automation, contact management, and CRM tools to help businesses communicate and engage with their customers.

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
string
bearer_token
string
generic_api_key
stringRequired

Connecting to Brevo

Create an auth config

Use the dashboard to create an auth config for the Brevo toolkit. This allows you to connect multiple Brevo accounts to Composio for agents to use.

1

Select App

Navigate to the Brevo toolkit page and click “Setup Integration”.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Integration”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4brevo_auth_config_id = "ac_YOUR_BREVO_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Brevo: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, brevo_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4brevo_auth_config_id = "ac_YOUR_BREVO_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": user_api_key}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Brevo for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, brevo_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Brevo toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["BREVO"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Create a company

Description

This tool allows you to create a new company in your brevo account.

Action Parameters

attributes
object
countryCode
integer
name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create or Update Email Template

Description

This tool creates a new email template or updates an existing one in brevo. if a 'templateid' is provided, it performs an update; otherwise, it creates a new template.

Action Parameters

attachmentUrl
string
htmlContent
string
htmlUrl
string
isActive
boolean
replyTo
string
sender
object
subject
string
tag
string
templateId
integer
templateName
string
toField
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create SMS Campaign

Description

This tool allows you to create a new sms campaign in brevo. you can specify the campaign name, sender, content, recipients (by providing list ids, exclusion list ids, or segment ids), and optionally schedule the campaign for a specific time. you can also enable unicode characters, add an organization prefix, and include unsubscribe instructions.

Action Parameters

content
stringRequired
name
stringRequired
organisationPrefix
string
recipients
object
scheduledAt
string
sender
stringRequired
unicodeEnabled
boolean
unsubscribeInstruction
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete a company

Description

Deletes a company from brevo using its unique identifier.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Contact

Description

Action Parameters

identifier
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Email Template

Description

This tool deletes an inactive email template from brevo. you need to provide the 'templateid' of the email template you want to delete. only inactive templates can be deleted.

Action Parameters

template_id
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete SMS Campaign

Description

This tool deletes an existing sms campaign.

Action Parameters

campaign_id
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Find Contact

Description

This tool checks if a contact exists in brevo. it searches for a contact using either an email address or mobile number, with the email being prioritized if both are provided.

Action Parameters

email
string
mobile_number
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Account Information

Description

This tool retrieves information about the brevo account, including account holder's email, first name, last name, company name, and address, as well as details about the current plan such as type, credits, start date, and end date.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all contacts

Description

This tool retrieves all contacts from your brevo account. it allows for pagination and filtering based on modification/creation dates, list ids, segment ids, and contact attributes.

Action Parameters

created_since
string
limit
integerDefaults to 50
list_ids
array
modified_since
string
offset
integer
segment_id
integer
sort
stringDefaults to desc

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all email templates

Description

This tool retrieves a list of all email templates created in your brevo account. it corresponds to the get /v3/smtp/templates endpoint as per the brevo api documentation, with optional parameters for filtering (templatestatus), pagination (limit, offset), and sorting (asc/desc).

Action Parameters

limit
integerDefaults to 50
offset
integer
sort
stringDefaults to desc
templateStatus
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get All Senders

Description

This tool retrieves a list of all senders associated with the brevo account. senders are the email addresses or domains that are authorized to send emails through brevo. this action can be useful for managing and verifying sender identities.

Action Parameters

domain
string
ip
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Company Details

Description

This tool retrieves the details of a specific company by its unique id.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Contact Details

Description

This tool retrieves detailed information about a specific contact in brevo. you can identify the contact using their email address (url-encoded), their unique contact id, or their sms attribute value.

Action Parameters

identifier
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get SMS Campaigns

Description

This tool retrieves a list of all sms campaigns created in brevo. it supports filtering by status, start date, and end date, and also allows controlling the number of results returned (limit), the starting point in the list (offset), and the sort order (asc or desc).

Action Parameters

endDate
string
limit
integerDefaults to 500
offset
integer
sort
stringDefaults to desc
startDate
string
status
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get SMS Campaign Details

Description

Retrieves the details of a specific sms campaign.

Action Parameters

campaign_id
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List All Companies

Description

This action retrieves a list of all companies stored in the brevo crm. it supports pagination and filtering by name and other attributes.

Action Parameters

filters
string
limit
integerDefaults to 50
linkedContactsIds
array
linkedDealsIds
array
page
integer
sort
stringDefaults to desc
sortBy
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Email Campaigns

Description

This tool retrieves a list of all email campaigns associated with the user's brevo account. it allows filtering by campaign type, status, start date, and end date. the response includes the total count of campaigns and an array of campaign objects, each containing details like id, name, subject, type, status, scheduled date/time, sender information, and optionally, campaign statistics.

Action Parameters

endDate
string
excludeHtmlContent
boolean
limit
integerDefaults to 50
offset
integer
sort
stringDefaults to desc
startDate
string
statistics
string
status
string
type
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Email Campaign

Description

Action Parameters

abTesting
boolean
attachmentUrl
string
campaign_id
integerRequired
footer
string
header
string
htmlContent
string
htmlUrl
string
increaseRate
integer
initialQuota
integer
inlineImageActivation
boolean
ipWarmupEnable
boolean
mirrorActive
booleanDefaults to True
name
string
params
object
previewText
string
recipients
object
recurring
boolean
replyTo
string
scheduledAt
string
sendAtBestTime
boolean
sender
object
splitRule
integer
subject
string
subjectA
string
subjectB
string
tag
string
toField
string
unsubscriptionPageId
string
updateFormId
string
utmCampaign
string
winnerCriteria
string
winnerDelay
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired