Interface BrevoSynchronisationService
- All Known Implementing Classes:
BrevoSynchronisationServiceImpl
public interface BrevoSynchronisationService
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final record
static enum
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createAttribute
(String name, BrevoSynchronisationService.AttributeType type, EntityList values) creates a new attributevoid
delete an attributevoid
importUsers
(long listId, Condition synchronisationCondition, List<BrevoSynchronisationService.AttributePath> attributes) Import users to brevo.boolean
isEmailAddressInUse
(String email) check if a contact with a given email address exists in BrevonormalizeAttributeName
(String name) adjust a string to be a valid brevo attribute name this means the string fulfills the following conditions: - is all upper case - starts with a later (prepend X if not fulfilled) - has no spaces (replace with underscores if not fulfilled)void
removeUsersFromList
(long listId, Condition synchronisationCondition) long
synchroniseFolder
(Entity folder) Synchronises a tocco folder to brevo.long
synchroniseList
(long folderId, Entity newsletterCategory) Synchronises a newsletter category with brevo.void
updateAttribute
(String name, BrevoSynchronisationService.AttributeType type, EntityList values) update attribute, only useful for category attributes, others need to be deleted and recreated for changesvoid
updateEmailAddresses
(Map<String, String> changes) update email addresses in brevo make sure that the email addresses exist in Brevo before updating them, seeisEmailAddressInUse(String)
-
Method Details
-
synchroniseFolder
Synchronises a tocco folder to brevo.- Parameters:
folder
- the brevo folder entity to be synchronised- Returns:
- id of the folder in brevo
-
synchroniseList
Synchronises a newsletter category with brevo. Newsletter categories are mapped to lists in brevo.- Parameters:
folderId
- the folder id to be used to create new newsletter categoriesnewsletterCategory
- the newsletter category to be synchronised- Returns:
- id of the list in brevo
-
importUsers
void importUsers(long listId, Condition synchronisationCondition, List<BrevoSynchronisationService.AttributePath> attributes) Import users to brevo. Users are transformed to "contacts" and then imported to brevo using the import endpoint. The import endpoint handles creating / updating users and maps users using the email address.- Parameters:
listId
- the list id to which the users should be added.synchronisationCondition
- query builder condition to be used to select the users to be synchronised
-
removeUsersFromList
-
getAttributes
- Returns:
- names of all attributes configured in brevo
-
createAttribute
void createAttribute(String name, BrevoSynchronisationService.AttributeType type, EntityList values) creates a new attribute- Parameters:
name
- the name of the attribute, make sure it is normalized withnormalizeAttributeName(String)
type
- the type of the attributevalues
- the Brevo_attribute_value entities the attribute can take, only relevant for category attributes
-
updateAttribute
void updateAttribute(String name, BrevoSynchronisationService.AttributeType type, EntityList values) update attribute, only useful for category attributes, others need to be deleted and recreated for changes- Parameters:
name
- the name of the attribute, make sure it is normalized withnormalizeAttributeName(String)
type
- the type of the attributevalues
- the Brevo_attribute_value entities the attribute can take, only relevant for category attributes
-
deleteAttribute
delete an attribute- Parameters:
name
- the name of the attribute, make sure it is normalized withnormalizeAttributeName(String)
type
- the type of the attribute
-
normalizeAttributeName
adjust a string to be a valid brevo attribute name this means the string fulfills the following conditions: - is all upper case - starts with a later (prepend X if not fulfilled) - has no spaces (replace with underscores if not fulfilled)- Parameters:
name
- any string- Returns:
- a valid attribute name
-
updateEmailAddresses
update email addresses in brevo make sure that the email addresses exist in Brevo before updating them, seeisEmailAddressInUse(String)
- Parameters:
changes
- a map containing the current email addresses as keys, and the new email addresses as values
-
isEmailAddressInUse
check if a contact with a given email address exists in Brevo- Parameters:
email
- the email address to check- Returns:
- true if a contact exists, false other
-