brevo
Brevo (formerly Sendinblue) is a marketing automation tool that helps businesses build customer relationships.
Usage
import { brevo } from 'netzo/apis/brevo.ts'
const api = brevo({
apiKey: Deno.env.get('BREVO_API_KEY')
})
Configuration
The brevo
factory function expects an object with the following, and returns an object with an API client api
.
Param | Type | Default | Description |
---|---|---|---|
apiKey | string | Deno.env.get('BREVO_API_KEY') | the api key to use for authentication |
Refer to the API documentation to get the required information.
Examples
The following examples assume you have created an api client instance.
Find contacts
Find all contacts with optional filtering and pagination.
const query: QueryContacts = {}
const result = await api.contacts.get<Contacts>(query)
const resultData = result.contacts
Get contact
Get a contact by its unique identifier, which can be id, email or SMS attribute value.
const query: QueryContact = {}
const resultData = await api.contacts[CONTACT_IDENTIFIER].get<Contact>(query)
Add contact
Add a new contact.
const data: DataAddContact = { email: '[email protected]' }
const resultData = await api.contacts.post<{ id: number }>(data)
Update contact
Update a contact by its unique identifier, which can be id, email or SMS attribute value.
const data: DataUpdateContact = {
attributes: {
EMAIL: '[email protected]'
}
}
await api.contacts[CONTACT_IDENTIFIER].put<void>(data)
Find email campaigns
Find all email campaigns that match the query.
const query: QueryEmailCampaigns = {}
const result = await api.emailCampaigns.get<EmailCampaigns>(query)
const resultData = result.campaigns
Find companies
Find all companies with optional filtering and pagination.
const query: QueryCompanies = {}
const result = await api.companies.get<Companies>(query)
const resultData = result.items