Skip to content

Commit

Permalink
Fix repeated subscription.
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenchio committed Jan 28, 2025
1 parent e8b1fe3 commit a4f7e4c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lambda-functions/newsletter_sign_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ def add_crisp_contact(email):
website_id=website_id,
people_id=email,
)
crisp.website.update_people_profile(
website_id=website_id,
people_id=contact_data['people_id'],
data={
'segments': ['newsletter'] + contact_data['segments'],
},
)
if 'newsletter' not in contact_data['segments']:
crisp.website.update_people_profile(
website_id=website_id,
people_id=contact_data['people_id'],
data={
'segments': ['newsletter'] + contact_data['segments'],
},
)
except RouteError:
contact_data = crisp.website.add_new_people_profile(
website_id=website_id,
Expand Down

0 comments on commit a4f7e4c

Please sign in to comment.