Skip to content

Commit

Permalink
Integration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-moore-97 committed Jan 31, 2024
1 parent e496e6f commit 82ccf00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 5 additions & 6 deletions qualtrix/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
)
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 4 additions & 2 deletions qualtrix/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down

0 comments on commit 82ccf00

Please sign in to comment.