Interface BrevoSynchronisationService

All Known Implementing Classes:
BrevoSynchronisationServiceImpl

public interface BrevoSynchronisationService
  • Method Details

    • synchroniseFolder

      long synchroniseFolder(Entity folder)
      Synchronises a tocco folder to brevo.
      Parameters:
      folder - the brevo folder entity to be synchronised
      Returns:
      id of the folder in brevo
    • synchroniseList

      long synchroniseList(long folderId, Entity newsletterCategory)
      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 categories
      newsletterCategory - 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

      void removeUsersFromList(long listId, Condition synchronisationCondition)
    • getAttributes

      List<String> 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 with normalizeAttributeName(String)
      type - the type of the attribute
      values - 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 with normalizeAttributeName(String)
      type - the type of the attribute
      values - the Brevo_attribute_value entities the attribute can take, only relevant for category attributes
    • deleteAttribute

      void deleteAttribute(String name, BrevoSynchronisationService.AttributeType type)
      delete an attribute
      Parameters:
      name - the name of the attribute, make sure it is normalized with normalizeAttributeName(String)
      type - the type of the attribute
    • normalizeAttributeName

      String normalizeAttributeName(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)
      Parameters:
      name - any string
      Returns:
      a valid attribute name
    • updateEmailAddresses

      void updateEmailAddresses(Map<String,String> changes)
      update email addresses in brevo make sure that the email addresses exist in Brevo before updating them, see isEmailAddressInUse(String)
      Parameters:
      changes - a map containing the current email addresses as keys, and the new email addresses as values
    • isEmailAddressInUse

      boolean isEmailAddressInUse(String email)
      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