Finished Script to push notes to GonG, just need an API Key. Pipedrive templates, Skuid Templates, got TripleSeat's templates ready for their sign in page. Few notes.

This commit is contained in:
Norm Rasmussen
2023-07-25 17:07:33 -04:00
parent 08c8f78f1c
commit d2378e4f44
26 changed files with 512 additions and 695 deletions

View File

@ -25,10 +25,10 @@ const getAllGroups = async (num) => {
}
})
.then(async (res) => {
if (res.data.links.next != null) {
if (res.data.links.next != null) {>
page++;
for (let i = 0; i < res.data.data.length; i++) {
if (res.data.data[i].attributes.status == "live") {
for (let i = 0; i < res.data.d
if (res.data.data[i].attribu
console.log(res.data.data[i].attributes.name)
groupIds.push(res.data.data[i].id)
}

View File

@ -1,7 +1,6 @@
import requests
import markdown
from pathlib import Path
import pathlib
import requests
import itertools
ndir = Path("/Users/normrasmussen/Documents/Work/CustomerNotes/")
@ -12,18 +11,81 @@ def get_files():
# This Section gets the Company name for the payload.
company = str(company)
company_file = company.split("/")[-1]
company_name = company[:-3]
print(company_name)
get_data(company_file, company_name)
company_name = company_file[:-3]
if company_name == "Bolt":
get_data(company_file, company_name)
def get_data(company_file, company_name):
company_path = Path(
f"/Users/normrasmussen/Documents/Work/CustomerNotes/{company_file}")
with company_path.open(mode="r", encoding="utf-8") as md_file:
for num, line in enumerate(md_file, 1):
if line.startswith("## "):
print(f"Line Number is {num} and the line is {line}")
sdir = "/Users/normrasmussen/Documents/Work/CustomerNotes/"
notes = []
line_num_array = []
text_array = []
company_path = Path(
f"/Users/normrasmussen/Documents/Work/CustomerNotes/{company_file}"
)
with company_path.open(mode="r", encoding="utf-8") as md_file:
line = company_path.read_text()[3]
# This first section finds the lines and adds them to an array.
# It also finds the "date" lines and adds them to a second array.
for num, line in enumerate(md_file):
line = line[:-1]
text_array.append(line)
if line.startswith("## "):
line_num_array.append(num)
# Since I don't know the last line of the file, I take the last
# number in the title array and adds 500,
# going well beyond the last line.
last_line = (line_num_array[-1], 500)
line_num_array.append(sum(last_line))
# This magic pairs each title based on the line numbers.
line_pairs = list(itertools.pairwise(line_num_array))
# We take each "grouping" and add it to an array as each singular item.
for index in line_pairs:
indv_notes = text_array[index[0] : index[1]]
notes.append(indv_notes)
# Now we are cleaning it up.
# Removing the hashes from the dates and titles.
for note in notes:
date = note[0][2:]
if note[2].startswith("### "):
note_title = note.pop(2)[3:]
copy = " ".join(note[1:])
def add_to_payload(date, note_title, copy, company_name):
payload = {
"records": [
{
"Author": "nrasmussen@gainsight.com",
"ContextName": company_name,
"TypeName": "Meeting",
"ExternalId": "WHAT IS THIS?",
"Subject": note_title,
"Notes": copy,
"ActivityDate": date,
"companyName": "AAR Corp Hardware Abscoa Division",
"internalAttendees": ["Norm Rasmussen"],
"externalAttendees": [""],
},
]
}
send_to_gs(payload)
def send_to_gs(payload):
url = "https://gongnxt.gainsightcloud.com/v1/ant/es/activity/bulk"
json = payload
headers = {
"Content Type": "JSON",
"Accesskey": APIKEY,
}
response = requests.post(url=url, headers=headers, json=payload)
if __name__ == "__main__":

View File

@ -0,0 +1,31 @@
let observer;
let config = {
attributes: true,
childList: true,
subtree: true
};
let eoqMutationObserver = () => {
let observeStarter = () => {
observer.observe(document,config);
}
let callback = () => {
if(document.querySelector('[data-test="activity-title"]').innerHTML == 'Let Us Know How We Did!'){
document.querySelector('[data-test="continue-button"]').click();
}
observer.disconnect();
observeStarter();
};
observer = new MutationObserver(() => {
if(document.querySelector('[data-test="quiz-summary"]')){
callback();
}
})
observer.observe(document, config);
}
eoqMutationObserver();