diff --git a/qualtrix/api.py b/qualtrix/api.py index 35fe21f..abea155 100644 --- a/qualtrix/api.py +++ b/qualtrix/api.py @@ -34,8 +34,8 @@ class SessionModel(SurveyModel): class RedirectModel(SurveyModel): targetSurveyId: str email: str - first_name: str - last_name: str + firstName: str + lastName: str @router.post("/bulk-responses") @@ -57,8 +57,8 @@ async def intake_redirect(request: RedirectModel): try: directory_entry = client.create_directory_entry( request.email, - request.first_name, - request.last_name, + request.firstName, + request.lastName, settings.DIRECTORY_ID, settings.MAILING_LIST_ID, ) @@ -96,10 +96,9 @@ async def create_reminder_distributions(distribution_id: str): async def add_user_to_contact_list(survey_link: str, contact_id: str): - contact = client.add_participant_to_contact_list( + return client.add_participant_to_contact_list( settings.DEMOGRAPHICS_SURVEY_LABEL, survey_link, contact_id ) - logging.info(f"add contact {contact} to contact list") @router.post("/survey-schema") diff --git a/qualtrix/client.py b/qualtrix/client.py index 026c8d9..2aab680 100644 --- a/qualtrix/client.py +++ b/qualtrix/client.py @@ -202,10 +202,12 @@ def add_participant_to_contact_list( header = copy.deepcopy(auth_header) header["Accept"] = "application/json" - logging.info("Add participant to the contact list") - add_particpant_payload = {"embeddedData": {survey_label: survey_link}} + logging.info( + f"Contact ({contact_id}) -> Directory ({settings.DIRECTORY_ID}), Mailing List ({settings.MAILING_LIST_ID})" + ) + r = requests.put( settings.BASE_URL + f"/directories/{settings.DIRECTORY_ID}/mailinglists/{settings.MAILING_LIST_ID}/contacts/{contact_id}",