@robinpath/brevo
0.1.2Node.jsPublicBrevo module for RobinPath.
Brevo
Brevo module for RobinPath.
Package: @robinpath/brevo | Category: Email Marketing | Type: Integration
Authentication
brevo.setCredentials "your-credentials"
Call this once at the start of your script before using any other function. Credentials persist for the duration of the script execution.
Use Cases
Use the brevo module when you need to:
- sendTransactionalEmail -- Use
brevo.sendTransactionalEmailto perform this operation - sendTransactionalSms -- Use
brevo.sendTransactionalSmsto perform this operation - listContacts -- Use
brevo.listContactsto perform this operation - getContact -- Use
brevo.getContactto perform this operation - createContact -- Use
brevo.createContactto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
setCredentials | Configure brevo credentials. | object |
sendTransactionalEmail | sendTransactionalEmail | object |
sendTransactionalSms | sendTransactionalSms | object |
listContacts | listContacts | object |
getContact | getContact | object |
createContact | createContact | object |
updateContact | updateContact | object |
deleteContact | deleteContact | object |
listLists | listLists | object |
getList | getList | object |
createList | createList | object |
addContactToList | addContactToList | object |
removeContactFromList | removeContactFromList | object |
listCampaigns | listCampaigns | object |
getCampaign | getCampaign | object |
createEmailCampaign | createEmailCampaign | object |
sendCampaign | sendCampaign | object |
getEmailEvents | getEmailEvents | object |
importContacts | importContacts | object |
Functions
setCredentials
Configure brevo credentials.
Module: brevo | Returns: object -- API response.
brevo.setCredentials
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | apiKey |
sendTransactionalEmail
sendTransactionalEmail
Module: brevo | Returns: object -- API response.
brevo.sendTransactionalEmail
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
sendTransactionalSms
sendTransactionalSms
Module: brevo | Returns: object -- API response.
brevo.sendTransactionalSms
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listContacts
listContacts
Module: brevo | Returns: object -- API response.
brevo.listContacts
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getContact
getContact
Module: brevo | Returns: object -- API response.
brevo.getContact
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createContact
createContact
Module: brevo | Returns: object -- API response.
brevo.createContact
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
updateContact
updateContact
Module: brevo | Returns: object -- API response.
brevo.updateContact
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
deleteContact
deleteContact
Module: brevo | Returns: object -- API response.
brevo.deleteContact
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listLists
listLists
Module: brevo | Returns: object -- API response.
brevo.listLists
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getList
getList
Module: brevo | Returns: object -- API response.
brevo.getList
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createList
createList
Module: brevo | Returns: object -- API response.
brevo.createList
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
addContactToList
addContactToList
Module: brevo | Returns: object -- API response.
brevo.addContactToList
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
removeContactFromList
removeContactFromList
Module: brevo | Returns: object -- API response.
brevo.removeContactFromList
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listCampaigns
listCampaigns
Module: brevo | Returns: object -- API response.
brevo.listCampaigns
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getCampaign
getCampaign
Module: brevo | Returns: object -- API response.
brevo.getCampaign
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createEmailCampaign
createEmailCampaign
Module: brevo | Returns: object -- API response.
brevo.createEmailCampaign
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
sendCampaign
sendCampaign
Module: brevo | Returns: object -- API response.
brevo.sendCampaign
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getEmailEvents
getEmailEvents
Module: brevo | Returns: object -- API response.
brevo.getEmailEvents
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
importContacts
importContacts
Module: brevo | Returns: object -- API response.
brevo.importContacts
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
Brevo API error (${res.status}): ${t} | Check the error message for details |
brevo.setCredentials requires apiKey. | Check the error message for details |
brevo.updateContact requires an ID. | Check the error message for details |
brevo.deleteContact requires an ID. | Check the error message for details |
brevo.removeContactFromList requires an ID. | Check the error message for details |
Brevo: "..." not configured. Call brevo.setCredentials first. | Check the error message for details |
@desc "Send transactional email and validate result"
do
set $result as brevo.sendTransactionalEmail
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. List and iterate Contacts
Retrieve all items and loop through them.
@desc "Setup authentication"
do
brevo.setCredentials $token
enddo
@desc "List contacts and iterate results"
do
set $result as brevo.listContacts
each $item in $result
print $item
end
enddo
2. Create a new item with sendTransactionalEmail
Create a new resource and capture the result.
@desc "Setup authentication"
do
brevo.setCredentials $token
enddo
@desc "Send transactional email"
do
set $result as brevo.sendTransactionalEmail
print "Created: " + $result
enddo
3. Create and update workflow
Create an item and then update it.
@desc "Setup authentication"
do
brevo.setCredentials $token
enddo
@desc "Send transactional email and update contact"
do
set $created as brevo.sendTransactionalEmail
# Update the created item
brevo.updateContact
enddo
4. Check before creating
List existing items and only create if needed.
@desc "Setup authentication"
do
brevo.setCredentials $token
enddo
@desc "List contacts and send transactional email"
do
set $existing as brevo.listContacts
if $existing == null
brevo.sendTransactionalEmail
print "Item created"
else
print "Item already exists"
end
enddo
5. Multi-step Brevo workflow
Chain multiple brevo operations together.
@desc "Setup authentication"
do
brevo.setCredentials $token
enddo
@desc "Send transactional email, send transactional sms, and more"
do
set $r_sendTransactionalEmail as brevo.sendTransactionalEmail
set $r_sendTransactionalSms as brevo.sendTransactionalSms
set $r_listContacts as brevo.listContacts
print "All operations complete"
enddo
6. Safe sendTransactionalEmail with validation
Check results before proceeding.
@desc "Setup authentication"
do
brevo.setCredentials $token
enddo
@desc "Send transactional email and validate result"
do
set $result as brevo.sendTransactionalEmail
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- activecampaign -- ActiveCampaign module for complementary functionality
- convertkit -- Convertkit module for complementary functionality
- mailchimp -- Mailchimp module for complementary functionality
- sendgrid -- SendGrid module for complementary functionality
- lemlist -- Lemlist module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.2 | latest | 1 months ago |
Related Modules
activecampaign
JS@robinpathv0.1.2
ActiveCampaign -- contacts, automations, campaigns, deals, lists, and tags via the ActiveCampaign REST API v3.
convertkit
JS@robinpathv0.1.1
Convertkit module for RobinPath.
@robinpathv0.1.1
Facebook module for RobinPath.
@robinpathv0.1.1
Instagram module for RobinPath.
$ robinpath add @robinpath/brevo
