Skip to content

Commit

Permalink
add api method to update brevo contact
Browse files Browse the repository at this point in the history
  • Loading branch information
madjid-asa committed Jun 28, 2024
1 parent e9f174c commit 86839da
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lemarche/utils/apis/api_brevo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ def create_contact(user, list_id: int):
logger.error(f"Exception when calling Brevo->ContactsApi->create_contact: {e}")


def update_contact(user_identifier: str, attributes_to_update: dict):
api_client = get_api_client()
api_instance = sib_api_v3_sdk.ContactsApi(api_client)
update_contact = sib_api_v3_sdk.UpdateContact(attributes=attributes_to_update)
try:
api_response = api_instance.update_contact(identifier=user_identifier, update_contact=update_contact)
logger.info(f"Success Brevo->ContactsApi->update_contact: {api_response}")
except ApiException as e:
logger.error(f"Exception when calling Brevo->ContactsApi->update_contact: {e}")


def remove_contact_from_list(user, list_id: int):
api_client = get_api_client()
api_instance = sib_api_v3_sdk.ContactsApi(api_client)
Expand Down

0 comments on commit 86839da

Please sign in to comment.