From 450eaee4f91111f9dab52b836198d8fabcf10556 Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Mon, 2 Oct 2023 17:05:14 -0400 Subject: [PATCH] Talkspace script for emails into props, G2, and Wild Health Notes. --- CustomerNotes/G2/G2.md | 23 +++++++++ CustomerNotes/Papa/Papa.md | 1 + CustomerNotes/Wildhealth/Wildhealth.md | 12 +++++ Scripts/API_Tests/add-pgaids.py | 4 +- Scripts/API_Tests/add_prop_csv.py | 4 +- Scripts/API_Tests/update_prop_from_email.py | 55 +++++++++++++++++++++ 6 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 Scripts/API_Tests/update_prop_from_email.py diff --git a/CustomerNotes/G2/G2.md b/CustomerNotes/G2/G2.md index fd39df80..fdf71a14 100644 --- a/CustomerNotes/G2/G2.md +++ b/CustomerNotes/G2/G2.md @@ -409,3 +409,26 @@ TODO: Discuss in Dec/Jan - how to measure success in G2U? What metrics are impor * She's creating a Learning Path for onboarding next, is thinking of using a badge for that completion instead of a cert. * Erin accepted the invitation to join the CE Advisory Board. + +## 10/02/2023 + +### Sync with Erin + +Questions about Erin's flow: + +* Erin doesn't touch Northpass until she's done with all the videos. +* Completes one chunk at a time + +Other Items: + +* Design team: October 12th due date. Launch on the 19th. +* Norm to submit ticket as soon as badges come in. +* Erin requested that name of course will be on badge +* If no badge, leave div blank. +* If course is completed and they have a badge, show badge under sub nav. + +Erin to put in fast lane request to switch Cert name from G2 Core to G2 Fundamentals. + +House keeping: + +* Erin in Boston - October 17th & 18th. diff --git a/CustomerNotes/Papa/Papa.md b/CustomerNotes/Papa/Papa.md index 3fc2eeb2..5beb4bcc 100644 --- a/CustomerNotes/Papa/Papa.md +++ b/CustomerNotes/Papa/Papa.md @@ -253,3 +253,4 @@ Not sure why, PALs might say one thing. Implementation call for 60 minutes, 2nd week of January. 9-13th Ask who else should be on the call. + diff --git a/CustomerNotes/Wildhealth/Wildhealth.md b/CustomerNotes/Wildhealth/Wildhealth.md index 4c9dd2dd..306c4d7a 100644 --- a/CustomerNotes/Wildhealth/Wildhealth.md +++ b/CustomerNotes/Wildhealth/Wildhealth.md @@ -228,3 +228,15 @@ DONE: Create Assignments Analytics for Google Sheets. ## 09/25/2023 - custom learning path flows + +## 10/02/2023 + +### New Learning Path Flows + +Kaitlyn confirmed we can run the flows the way they would like. She would just "hide" or make the LP course non-clickable +until the date arrives where they can access the course. + +- Abby to send list of product IDs, Learning Path name, Course names, etc. +- Abby to create group and send Norm name. +- Bailey asked if she could add more courses to the group and get the person access - yes! +- Get this done sooner than later! Confirm with Kaitlyn how to make it "live" without giving access. diff --git a/Scripts/API_Tests/add-pgaids.py b/Scripts/API_Tests/add-pgaids.py index 1f3dcb1e..bdc468d2 100644 --- a/Scripts/API_Tests/add-pgaids.py +++ b/Scripts/API_Tests/add-pgaids.py @@ -4,7 +4,7 @@ from pathlib import Path import Apikeys import os -basefile = "/Users/normrasmussen/Downloads/MizunoAug_Completions.csv" +basefile = "/Users/normrasmussen/Downloads/Mizuno-September23-Completions.csv" api_key = Apikeys.mizuno uuid_url = "https://api.northpass.com/v2/people?filter[email][eq]=" prop_url = "https://api.northpass.com/v2/properties/people/" @@ -51,7 +51,7 @@ def load_file(basefile): # completions = completions.iloc[:, 0:] print(completions) completions.to_csv( - "/Users/normrasmussen/Downloads/MizunoCompletions_with_PGAIDs.csv", + "/Users/normrasmussen/Downloads/Mizuno-09.23-Completions_with_PGAIDs.csv", index=False, ) diff --git a/Scripts/API_Tests/add_prop_csv.py b/Scripts/API_Tests/add_prop_csv.py index cb91f0b6..856fdeef 100644 --- a/Scripts/API_Tests/add_prop_csv.py +++ b/Scripts/API_Tests/add_prop_csv.py @@ -4,8 +4,8 @@ from pathlib import Path import Apikeys import os -basefile = "/Users/normrasmussen/Downloads/client-learners.csv" -api_key = Apikeys.wildhealth_edportal +basefile = "/Users/normrasmussen/Downloads/talkspace-paid-learners.csv" +api_key = Apikeys.talkspace_1099 prop_url = "https://api.northpass.com/v2/properties/people/" headers = { "accept": "*/*", diff --git a/Scripts/API_Tests/update_prop_from_email.py b/Scripts/API_Tests/update_prop_from_email.py new file mode 100644 index 00000000..5368a037 --- /dev/null +++ b/Scripts/API_Tests/update_prop_from_email.py @@ -0,0 +1,55 @@ +import requests +import Apikeys +import csv + +apikey = Apikeys.talkspace_1099 +url_email = "https://api.northpass.com/v2/people?filter[email][eq]=" +import_list = "/Users/normrasmussen/Downloads/Talkspace-bulk.csv" + +def getfromEmail(url_email, apikey, import_list): + uuid = "" + with open(import_list, newline='') as csvfile: + file = csv.reader(csvfile, delimiter=',') + for items in file: + email = items[0] + url = url_email + f"{email}" + headers = { + "accept": "*/*", + "x-api-key": apikey, + "content-type": "application/json", + } + response = requests.get(url, headers=headers) + if response.status_code == 200: + response = response.json() + for data in response["data"]: + uuid = data["id"] + items.append(uuid) + # print(uuid) + add_multi_prop(uuid) + else: + print("Another Error!") + +def add_multi_prop(uuid): + url = "https://api.northpass.com/v2/properties/people/bulk" + payload = {"data": [ + { + "type": "person_properties", + "attributes": {"properties": { + "paid": "true", + }}, + "id": uuid + } + ]} + headers = { + "accept": "application/json", + "content-type": "application/json", + "X-Api-Key": apikey} + response = requests.post(url, json=payload, headers=headers) + + if response.status_code == 404 or response.status_code == 403: + print(f"Error {response.status_code} with user {uuid}") + else: + print(f"Successfully Added props for {uuid}!") + +if __name__ == "__main__": + getfromEmail(url_email, apikey, import_list)