Artera Google Script Completed
This commit is contained in:
@ -1 +0,0 @@
|
|||||||
# Northpass
|
|
||||||
@ -1 +0,0 @@
|
|||||||
{"icon":" ","data":".mind\/data\/20220906094735-Northpass.md","uid":"20220906094343","contents":[{"text":"Northpass"}],"type":1}
|
|
||||||
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Launch and Debug Standalone Blazor WebAssembly App",
|
|
||||||
"type": "blazorwasm",
|
|
||||||
"request": "launch",
|
|
||||||
"cwd": "${workspaceFolder}/CS_Todo"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"cSpell.ignoreWords": [],
|
|
||||||
"cSpell.words": []
|
|
||||||
}
|
|
||||||
41
.vscode/tasks.json
vendored
41
.vscode/tasks.json
vendored
@ -1,41 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "build",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"build",
|
|
||||||
"${workspaceFolder}/CS_Todo/CS_Todo.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "publish",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"publish",
|
|
||||||
"${workspaceFolder}/CS_Todo/CS_Todo.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "watch",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"watch",
|
|
||||||
"run",
|
|
||||||
"--project",
|
|
||||||
"${workspaceFolder}/CS_Todo/CS_Todo.csproj"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -8,6 +8,7 @@ Alison is Chris' back up
|
|||||||
|
|
||||||
End of Q3 Launch, maybe a soft launch?
|
End of Q3 Launch, maybe a soft launch?
|
||||||
Moving to Vegas, 2 weeks gone in - August 22-Sept 5
|
Moving to Vegas, 2 weeks gone in - August 22-Sept 5
|
||||||
|
|
||||||
* Content:
|
* Content:
|
||||||
5-7 courses, completely thought out with quizzes etc
|
5-7 courses, completely thought out with quizzes etc
|
||||||
Each course to a different audience
|
Each course to a different audience
|
||||||
@ -26,7 +27,7 @@ Back fill badges
|
|||||||
|
|
||||||
* [ ] Test Todo
|
* [ ] Test Todo
|
||||||
|
|
||||||
- [X] Send ticket for font changes
|
* [X] Send ticket for font changes
|
||||||
[X] Northpass ACademy Dashboard Personalized Copy, same as NP Academy
|
[X] Northpass ACademy Dashboard Personalized Copy, same as NP Academy
|
||||||
[X] Keep learning path card formatting, scroll left to right
|
[X] Keep learning path card formatting, scroll left to right
|
||||||
[X] Calendar - does Recast have an embeddable calendar? Feed is okay instead of calendar replicate Northpass academy calendar
|
[X] Calendar - does Recast have an embeddable calendar? Feed is okay instead of calendar replicate Northpass academy calendar
|
||||||
@ -38,6 +39,7 @@ main page links up top like swift
|
|||||||
RTE within course viewer not picking up font change
|
RTE within course viewer not picking up font change
|
||||||
|
|
||||||
## 11/15/2022
|
## 11/15/2022
|
||||||
|
|
||||||
* Chris to grab screenshots from all the videos that are to be uploaded to Wistia for the non-video.
|
* Chris to grab screenshots from all the videos that are to be uploaded to Wistia for the non-video.
|
||||||
* Going live tomorrow - 11/16
|
* Going live tomorrow - 11/16
|
||||||
* 14 out of the 29 people responded to Recast saying they want to be registered and part of the academy.
|
* 14 out of the 29 people responded to Recast saying they want to be registered and part of the academy.
|
||||||
@ -46,18 +48,41 @@ RTE within course viewer not picking up font change
|
|||||||
* After this beta, we will find out if his learners love the academy or not. "It's better than documentation"
|
* After this beta, we will find out if his learners love the academy or not. "It's better than documentation"
|
||||||
* Hard & Full launch of the academy on December 5th.
|
* Hard & Full launch of the academy on December 5th.
|
||||||
* Logic for december 5th? December becomes a very slow season for tech industry
|
* Logic for december 5th? December becomes a very slow season for tech industry
|
||||||
* They have a number of initiatives company wide
|
* They have a number of initiatives company wide
|
||||||
* Conflict between deadlines and they don't want to take away from those initiatives
|
* Conflict between deadlines and they don't want to take away from those initiatives
|
||||||
* Email that will correspond with another campaign in the company
|
* Email that will correspond with another campaign in the company
|
||||||
*Zero State Messages*
|
*Zero State Messages*
|
||||||
* If someone has no courses or LPs - what should the zero state message be?
|
* If someone has no courses or LPs - what should the zero state message be?
|
||||||
* Should we hide the sub nav option is there are no LP's available?
|
* Should we hide the sub nav option is there are no LP's available?
|
||||||
* Chris to talk to Marketing about what would be best for zero states.
|
* Chris to talk to Marketing about what would be best for zero states.
|
||||||
|
|
||||||
*Other Items from Chris:*
|
*Other Items from Chris:*
|
||||||
|
|
||||||
* He wants to separate intstructors for ILTs and Courses. Why?
|
* He wants to separate intstructors for ILTs and Courses. Why?
|
||||||
* One of his instructors does a review course, but they don't have any webinars right now, but wanted to make it look more full. Not bare bones.
|
* One of his instructors does a review course, but they don't have any webinars right now, but wanted to make it look more full. Not bare bones.
|
||||||
* The problem for Recast is that the people who do webinars are not part of their company. So giving them manager access is a bit concerning.
|
* The problem for Recast is that the people who do webinars are not part of their company. So giving them manager access is a bit concerning.
|
||||||
* Working with IT guy on DNS items. His guy made all the changes (roughly 30 min ago) but Northpass still says pending.
|
* Working with IT guy on DNS items. His guy made all the changes (roughly 30 min ago) but Northpass still says pending.
|
||||||
* He couldn't add the TXT record because of string length, he just left it as "recastsoftware". Max length = 1024, Provider =
|
* He couldn't add the TXT record because of string length, he just left it as "recastsoftware". Max length = 1024, Provider =
|
||||||
* TTL is one hour, so it could take some time.
|
* TTL is one hour, so it could take some time.
|
||||||
|
|
||||||
|
## 01/17/2023
|
||||||
|
|
||||||
|
### Certs, Salesforce, Future
|
||||||
|
|
||||||
|
Stacy Nwokochah - CS Ops, role is new and she has only been there 6 months.
|
||||||
|
|
||||||
|
This quarter goals:
|
||||||
|
|
||||||
|
* 8 courses need to be completed - in a LP
|
||||||
|
* At the end of that, big exam, learners must pass with a certain score
|
||||||
|
* Certification!
|
||||||
|
|
||||||
|
Deadline: Chris will have courses/LP done by third week of April. Must be done by April 30th.
|
||||||
|
Announcement: April 30th.
|
||||||
|
|
||||||
|
They also want to track certs, share on linkedin, etc.
|
||||||
|
|
||||||
|
Stacy: Salesforce Integration, wants to use ChurnZero too.
|
||||||
|
|
||||||
|
Other: Chris giving a webinar "Quick Start Guide for the Academy". He will be teasing Certs and LPs in the webinar. He will show the UI for a learning path and other random objects. If we can have anything ready to show regarding Certs, that would be helpful. The webinar is Next Thursday January 26th.
|
||||||
|
Ideally, the cert will show that the learner is "Right Click Certified".
|
||||||
|
|||||||
@ -265,6 +265,12 @@ Jenna to send the list of courses that she wants us to check and make sure they
|
|||||||
Therapists have 30 days from the date they completed the managed care course.
|
Therapists have 30 days from the date they completed the managed care course.
|
||||||
Add when they completed the entire group of training
|
Add when they completed the entire group of training
|
||||||
Need to know:
|
Need to know:
|
||||||
|
|
||||||
* Date Managed Care/Getting Started Course completed (Start Date)
|
* Date Managed Care/Getting Started Course completed (Start Date)
|
||||||
* All Compliance Courses Completed (Completion Date)
|
* All Compliance Courses Completed (Completion Date)
|
||||||
* 30 difference/requirement between those dates.
|
* 30 difference/requirement between those dates.
|
||||||
|
|
||||||
|
|
||||||
|
## 01/17/2023
|
||||||
|
|
||||||
|
### Standard Meeting
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
{"scriptId":"1TtrlsqzXey172jgJ2O8KLOudCm8p-q8aePsWRS4m3_HgLyOgmO1AWKrY","rootDir":"/Users/normrasmussen/Documents/Northpass/Scripts/GoogleScripts/Artera_wowprog"}
|
{"scriptId":"1TtrlsqzXey172jgJ2O8KLOudCm8p-q8aePsWRS4m3_HgLyOgmO1AWKrY","rootDir":"/Users/normrasmussen/Documents/Northpass/Scripts/GoogleScripts/Artera_wowprog","projectId":"appscriptslocaldev"}
|
||||||
|
|||||||
1
Scripts/GoogleScripts/Artera_wowprog/.clasprc.json
Normal file
1
Scripts/GoogleScripts/Artera_wowprog/.clasprc.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"token":{"access_token":"ya29.a0AX9GBdXiioWBdtoVWI2RMz3w20lAhDMGbSH0G0hvCqUE51N9mNwR6Q2YegprBi-uLPjUQCn-Sff08o1yJUcMYY0jDuO7LCF061zu3Vlh-376Elz5-jXNrePuKaNxB73aLWsBPqKNWjf08RKMCEy2kBDQULaXaCgYKAbYSARASFQHUCsbC2bxYHKbnr9AwbIBf9rfVfQ0163","refresh_token":"1//01cyoCuw3Wr0xCgYIARAAGAESNwF-L9Ir2krbuxda1cDzPQRSodYRr4leW0_Rdu4wcMUtJn1TMn_5-yw-UNSLjOoY-JxbkLZvJ0I","scope":"https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/script.webapp.deploy","token_type":"Bearer","expiry_date":1673971176372},"oauth2ClientSettings":{"clientId":"979249900345-7tlqhlra786jbp15eddnlh9iracitoq8.apps.googleusercontent.com","clientSecret":"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","redirectUri":"http://localhost"},"isLocalCreds":true}
|
||||||
@ -1,29 +1,67 @@
|
|||||||
var now = new Date();
|
var now = new Date();
|
||||||
var today = Utilities.formatDate(now, 'America/New_York', 'MM/dd/yyyy');
|
var today = Utilities.formatDate(now, 'America/New_York', 'MM/dd/yyyy');
|
||||||
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
|
const readSheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
|
||||||
const sheet2 = SpreadsheetApp.getActiveSpreadsheet().getSheets()[1];
|
const writeSheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[1];
|
||||||
var lastColumn = sheet2.getLastColumn()+1;
|
|
||||||
//Logger.log(lastColumn)
|
|
||||||
|
|
||||||
|
// This function needs to happen every time the script runs.
|
||||||
function writeHeadings() {
|
function writeHeadings() {
|
||||||
// Write the new Column Headings
|
// Write the new Column Headings
|
||||||
sheet2.getRange(1, lastColumn).setValue("Percent Change");
|
var lastColumn = writeSheet.getLastColumn()+1;
|
||||||
sheet2.getRange(1, lastColumn+1).setValue("Progress");
|
writeSheet.getRange(1, lastColumn).setValue("Percent Change");
|
||||||
sheet2.getRange(2, lastColumn+1).setValue(today);
|
writeSheet.getRange(1, lastColumn+1).setValue("Progress");
|
||||||
// addtoSheet()
|
writeSheet.getRange(2, lastColumn+1).setValue(today);
|
||||||
|
addProgress(lastColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addtoSheet() {
|
// This function takes the progress from Column D of Sheet0 and adds it to Sheet1
|
||||||
var numRows = sheet.getLastRow()-1; // Number of rows to process
|
function addProgress(lastColumn, prevColumn) {
|
||||||
var dataRange = sheet.getRange(2, 2, numRows, 3);
|
// Process Data from Sheet0
|
||||||
|
var numRows = readSheet.getLastRow()-1; // Number of rows to process
|
||||||
|
var dataRange = readSheet.getRange(2, 2, numRows, 3);
|
||||||
|
// Process First Row from Sheet1
|
||||||
|
// var numRows = writeSheet.getLastRow()-1; // Number of rows to process
|
||||||
|
// var dataRange = writeSheet.getRange(3, 1, numRows, 1);
|
||||||
var values = dataRange.getValues();
|
var values = dataRange.getValues();
|
||||||
|
|
||||||
for (item in values) {
|
for (item in values) {
|
||||||
var row = values[item];
|
var row = values[item];
|
||||||
var course= row[0];
|
var course= row[0];
|
||||||
var avgProgress = row [2];
|
var avgProgress = row [2];
|
||||||
//var setRow = i+1
|
findRow(course, avgProgress, lastColumn);
|
||||||
//sheet2.getRange(setRow, 1).setValue(course);
|
|
||||||
//sheet2.getRange(setRow, 2).setValue(avgProgress);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findRow(course, avgProgress, lastColumn) {
|
||||||
|
var prevColumn = writeSheet.getLastColumn()-2;
|
||||||
|
var numRows = writeSheet.getLastRow();
|
||||||
|
var data = writeSheet.getRange(3,1,numRows,1).getValues();
|
||||||
|
for(var i = 0; i<data.length;i++){
|
||||||
|
if(data[i][0] == course){
|
||||||
|
var row = i+3;
|
||||||
|
var prevVal = writeSheet.getRange(row, prevColumn).getValues();
|
||||||
|
writeSheet.getRange(row, lastColumn+1).clearFormat();
|
||||||
|
writeSheet.getRange(row, lastColumn).clearFormat();
|
||||||
|
writeSheet.getRange(row, lastColumn+1).setValue(avgProgress);
|
||||||
|
writeSheet.getRange(row, lastColumn).setValue(percentDiff(prevVal, avgProgress));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function percentDiff(prevVal, avgProgress){
|
||||||
|
var prevVal = prevVal-0
|
||||||
|
var avgProgress = avgProgress-0
|
||||||
|
var percentChange = percentChange-0
|
||||||
|
// This block will NOT show negative changes. So if a number decreases from one week to the next, it will still show a POSITIVE % change.
|
||||||
|
// var percentChange =
|
||||||
|
// (
|
||||||
|
// (Math.abs(prevVal-avgProgress))/((prevVal+avgProgress)/2)
|
||||||
|
// )
|
||||||
|
// return percentChange
|
||||||
|
|
||||||
|
// Business Math! This will show negativos.
|
||||||
|
var percentChange =
|
||||||
|
(
|
||||||
|
(avgProgress-prevVal)/(prevVal)
|
||||||
|
)
|
||||||
|
return percentChange
|
||||||
|
}
|
||||||
|
|||||||
6
Scripts/GoogleScripts/Artera_wowprog/MathExamples.js
Normal file
6
Scripts/GoogleScripts/Artera_wowprog/MathExamples.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// Logger.log(myFunction());
|
||||||
|
|
||||||
|
// function myFunction() {
|
||||||
|
// var x = 5
|
||||||
|
// return x-7
|
||||||
|
// }
|
||||||
@ -3,5 +3,11 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
},
|
},
|
||||||
"exceptionLogging": "STACKDRIVER",
|
"exceptionLogging": "STACKDRIVER",
|
||||||
"runtimeVersion": "V8"
|
"runtimeVersion": "V8",
|
||||||
|
"executionApi": {
|
||||||
|
"access": "ANYONE"
|
||||||
|
},
|
||||||
|
"oauthScopes": [
|
||||||
|
"https://www.googleapis.com/auth/spreadsheets"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
1
Scripts/GoogleScripts/TS_Tests/.clasp.json
Normal file
1
Scripts/GoogleScripts/TS_Tests/.clasp.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"scriptId":"1Ezp_qTdiqvnQ1UjbyHOliax03WZqu-H_BBxMNBnwRmDJ-V36WyJ9a_hj","rootDir":"/Users/normrasmussen/Documents/Northpass/Scripts/GoogleScripts/TS_Tests"}
|
||||||
86
Scripts/GoogleScripts/TS_Tests/Code.js
Normal file
86
Scripts/GoogleScripts/TS_Tests/Code.js
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
const sheet = SpreadsheetApp.getActiveSheet();
|
||||||
|
const apiKey = '18Zl2NAzWTE09FHbNEBngNOJO';
|
||||||
|
|
||||||
|
function getUuids() {
|
||||||
|
var sheet = SpreadsheetApp.getActiveSheet();
|
||||||
|
var numRows = sheet.getLastRow()-1; // Number of rows to process
|
||||||
|
var dataRange = sheet.getRange(3, 3, numRows, 1);
|
||||||
|
var values = dataRange.getValues();
|
||||||
|
writeHeadings();
|
||||||
|
|
||||||
|
for (email in values){
|
||||||
|
var row = values[email];
|
||||||
|
var email = row[0]
|
||||||
|
var api_url = 'https://api.northpass.com/v2/people/?filter[email][eq]='+email;
|
||||||
|
const settings = {
|
||||||
|
async: true,
|
||||||
|
crossDomain: true,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
accept: 'application/json',
|
||||||
|
'X-Api-Key': apiKey
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||||
|
var uuidResponse = sendMsg.getContentText();
|
||||||
|
var parsedata = JSON.parse(uuidResponse);
|
||||||
|
try {
|
||||||
|
var uuid = parsedata["data"][0]["id"];
|
||||||
|
if (email != "") {
|
||||||
|
findRow(email, uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(ex) {
|
||||||
|
Logger.log(ex)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function findRow(email, uuid){
|
||||||
|
var sheetRow = SpreadsheetApp.getActiveSpreadsheet();
|
||||||
|
var data = sheetRow.getDataRange().getValues();
|
||||||
|
for(var i = 0; i<data.length;i++){
|
||||||
|
if(data[i][2] == email){ //[1] because column B
|
||||||
|
// Logger.log((i+1))
|
||||||
|
var row = i+1;
|
||||||
|
propstoSheet(uuid, row, email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function propstoSheet(uuid, row, email) {
|
||||||
|
var uuid_url = 'https://api.northpass.com/v2/properties/people/'+uuid;
|
||||||
|
const settings = {
|
||||||
|
async: true,
|
||||||
|
crossDomain: true,
|
||||||
|
url: uuid_url,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
accept: 'application/json',
|
||||||
|
'X-Api-Key': apiKey,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const sendMsg = UrlFetchApp.fetch(uuid_url, settings);
|
||||||
|
var txtResponse = sendMsg.getContentText();
|
||||||
|
var parseProps = JSON.parse(txtResponse);
|
||||||
|
var role = parseProps["data"]["attributes"]["properties"]["role_type"];
|
||||||
|
var user_id = parseProps["data"]["attributes"]["properties"]["user_id"];
|
||||||
|
var paid = parseProps["data"]["attributes"]["properties"]["paid"];
|
||||||
|
|
||||||
|
// Write the Data to each row and column
|
||||||
|
sheet.getRange(row, 17).setValue(role);
|
||||||
|
sheet.getRange(row, 18).setValue(user_id);
|
||||||
|
sheet.getRange(row, 19).setValue(paid);
|
||||||
|
// Logger.log(row + "," + email);
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeHeadings() {
|
||||||
|
// Write the new Column Headings
|
||||||
|
sheet.getRange(1, 17).setValue("Role");
|
||||||
|
sheet.getRange(1, 18).setValue("ID Number");
|
||||||
|
sheet.getRange(1, 18).clearFormat();
|
||||||
|
sheet.getRange(1, 19).setValue("Paid?");
|
||||||
|
}
|
||||||
1
Scripts/GoogleScripts/Talkspace_GroupProg/.clasp.json
Normal file
1
Scripts/GoogleScripts/Talkspace_GroupProg/.clasp.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"scriptId":"1bQmNUsajsg6_PNupRskhkg7DvMGs2-uBreKmcdfjtQO69947qvZeJNqW","rootDir":"/Users/normrasmussen/Documents/Northpass/Scripts/GoogleScripts/Talkspace_GroupProg"}
|
||||||
86
Scripts/GoogleScripts/Talkspace_GroupProg/Code.js
Normal file
86
Scripts/GoogleScripts/Talkspace_GroupProg/Code.js
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
const sheet = SpreadsheetApp.getActiveSheet();
|
||||||
|
const apiKey = '18Zl2NAzWTE09FHbNEBngNOJO';
|
||||||
|
|
||||||
|
function getUuids() {
|
||||||
|
var sheet = SpreadsheetApp.getActiveSheet();
|
||||||
|
var numRows = sheet.getLastRow()-1; // Number of rows to process
|
||||||
|
var dataRange = sheet.getRange(3, 3, numRows, 1);
|
||||||
|
var values = dataRange.getValues();
|
||||||
|
writeHeadings();
|
||||||
|
|
||||||
|
for (email in values){
|
||||||
|
var row = values[email];
|
||||||
|
var email = row[0]
|
||||||
|
var api_url = 'https://api.northpass.com/v2/people/?filter[email][eq]='+email;
|
||||||
|
const settings = {
|
||||||
|
async: true,
|
||||||
|
crossDomain: true,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
accept: 'application/json',
|
||||||
|
'X-Api-Key': apiKey
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||||
|
var uuidResponse = sendMsg.getContentText();
|
||||||
|
var parsedata = JSON.parse(uuidResponse);
|
||||||
|
try {
|
||||||
|
var uuid = parsedata["data"][0]["id"];
|
||||||
|
if (email != "") {
|
||||||
|
findRow(email, uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(ex) {
|
||||||
|
Logger.log(ex)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function findRow(email, uuid){
|
||||||
|
var sheetRow = SpreadsheetApp.getActiveSpreadsheet();
|
||||||
|
var data = sheetRow.getDataRange().getValues();
|
||||||
|
for(var i = 0; i<data.length;i++){
|
||||||
|
if(data[i][2] == email){ //[1] because column B
|
||||||
|
// Logger.log((i+1))
|
||||||
|
var row = i+1;
|
||||||
|
propstoSheet(uuid, row, email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function propstoSheet(uuid, row, email) {
|
||||||
|
var uuid_url = 'https://api.northpass.com/v2/properties/people/'+uuid;
|
||||||
|
const settings = {
|
||||||
|
async: true,
|
||||||
|
crossDomain: true,
|
||||||
|
url: uuid_url,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
accept: 'application/json',
|
||||||
|
'X-Api-Key': apiKey,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const sendMsg = UrlFetchApp.fetch(uuid_url, settings);
|
||||||
|
var txtResponse = sendMsg.getContentText();
|
||||||
|
var parseProps = JSON.parse(txtResponse);
|
||||||
|
var role = parseProps["data"]["attributes"]["properties"]["role_type"];
|
||||||
|
var user_id = parseProps["data"]["attributes"]["properties"]["user_id"];
|
||||||
|
var paid = parseProps["data"]["attributes"]["properties"]["paid"];
|
||||||
|
|
||||||
|
// Write the Data to each row and column
|
||||||
|
sheet.getRange(row, 13).setValue(role);
|
||||||
|
sheet.getRange(row, 14).setValue(user_id);
|
||||||
|
sheet.getRange(row, 15).setValue(paid);
|
||||||
|
// Logger.log(row + "," + email);
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeHeadings() {
|
||||||
|
// Write the new Column Headings
|
||||||
|
sheet.getRange(1, 13).setValue("Role");
|
||||||
|
sheet.getRange(1, 14).setValue("ID Number");
|
||||||
|
sheet.getRange(1, 14).clearFormat();
|
||||||
|
sheet.getRange(1, 15).setValue("Paid?");
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"timeZone": "America/New_York",
|
||||||
|
"dependencies": {
|
||||||
|
},
|
||||||
|
"exceptionLogging": "STACKDRIVER",
|
||||||
|
"runtimeVersion": "V8"
|
||||||
|
}
|
||||||
10
Scripts/GoogleScripts/WCA_Webhook/appsscript.json
Normal file
10
Scripts/GoogleScripts/WCA_Webhook/appsscript.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"timeZone": "America/New_York",
|
||||||
|
"dependencies": {},
|
||||||
|
"exceptionLogging": "STACKDRIVER",
|
||||||
|
"runtimeVersion": "V8",
|
||||||
|
"webapp": {
|
||||||
|
"executeAs": "USER_DEPLOYING",
|
||||||
|
"access": "ANYONE_ANONYMOUS"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,219 +0,0 @@
|
|||||||
/*
|
|
||||||
This script sends a daily reminder to the Sales and Marketing channel as to which
|
|
||||||
lines of data are unclean and not filled out. Currently, it is only pulling from the last 5 days.
|
|
||||||
This will be sent out between 3-4pm so that AEs can get their data in and clean before EOD.
|
|
||||||
Any questions or changes needed, see Norm.
|
|
||||||
Webhook URL in this sheet is for #sales-n-marketing channel.
|
|
||||||
*/
|
|
||||||
// Setup of the sheet
|
|
||||||
const sheet = SpreadsheetApp.getActiveSheet();
|
|
||||||
|
|
||||||
// Setup of the date range to compare. Currently, it is using 5 days until Present.
|
|
||||||
var now = new Date();
|
|
||||||
var formatNow = Utilities.formatDate(now, 'America/New_York', 'MM/dd/yyyy'); // Today
|
|
||||||
var daysToSubtract = 2;
|
|
||||||
var withinWeek = new Date(now.getTime()-daysToSubtract*(3600*24*1000));
|
|
||||||
var formatWeek = Utilities.formatDate(withinWeek, 'America/New_York', 'MM/dd/yyyy'); // 5 Days ago
|
|
||||||
|
|
||||||
// Counter for formatting the final list
|
|
||||||
var meetingCount = 0;
|
|
||||||
|
|
||||||
// Other empty Globals
|
|
||||||
var finalAEList;
|
|
||||||
var tagUsers;
|
|
||||||
|
|
||||||
/*
|
|
||||||
This function will create two empty arrays, one for the list of missed entries and one for tagging users in Slack
|
|
||||||
First, the function gets the data ranges in spreadsheed and adds those columns to an array index.
|
|
||||||
Second, the for loop cycles through the super long array (4 results per line). Based on the if statement,
|
|
||||||
the loop removes all arrays that don't fit the statement.
|
|
||||||
*/
|
|
||||||
function findMeetings() { // Setting up data range and empty arrays
|
|
||||||
var startRow = 2; // First row of data to process
|
|
||||||
var numRows = sheet.getLastRow()-1; // Number of rows to process
|
|
||||||
var dataRange = sheet.getRange(startRow, 1, numRows, sheet.getLastColumn());
|
|
||||||
var data = dataRange.getValues();
|
|
||||||
var slackingAEListOne = [];
|
|
||||||
var tagList = [];
|
|
||||||
|
|
||||||
for (i in data) { // For a data row within the entire data range
|
|
||||||
var row = data[i];
|
|
||||||
let attended = row[6]; // Column G
|
|
||||||
var name = row[1]; // Column - B
|
|
||||||
var date = Utilities.formatDate(row[3],'America/New_York','MM/dd/yyyy'); // Column - D
|
|
||||||
var company = row[4]; // Column - E
|
|
||||||
let missedEntries = [name, date, company, attended];
|
|
||||||
/*
|
|
||||||
Adding a For Loop will pull a result for EACH element, aka 4 results per line.
|
|
||||||
This pulls one for each group of missedEntries
|
|
||||||
This then removes the last value (attended, since we already know it is a blank), converts to a string,
|
|
||||||
and adds to a new array. The counter will compare if there is more than one entry in the array.
|
|
||||||
*/
|
|
||||||
if ((missedEntries[3] == "") && (missedEntries[1] >= formatWeek) && (missedEntries[1] <= formatNow)) {
|
|
||||||
meetingCount += 1;
|
|
||||||
missedEntries.pop();
|
|
||||||
missedEntries.toString();
|
|
||||||
slackingAEListOne.push(missedEntries);
|
|
||||||
//Logger.log(slackingAEListOne);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
/* Now outside of the if statement:
|
|
||||||
the array is built, and we want each group to be on a new line, remove the commas and add a hyphen.
|
|
||||||
The counter counts if there is 1 or more meetings, or not. If 0, it sends a certain message, not tagging anyone.
|
|
||||||
If it is one or more, it splices by the first array (index 0), adds a new line, and replaces commans with hyphens.
|
|
||||||
*/
|
|
||||||
if (meetingCount >= 1) {
|
|
||||||
var slackingAEListTwo = slackingAEListOne.splice(0).join('\n');
|
|
||||||
var finalAEList = slackingAEListTwo.replace(/,/g, ' - ');
|
|
||||||
// This if statement is going to only tag those who appear in the previous list.
|
|
||||||
// No need to tag people who have done their work and contribute to clean data.
|
|
||||||
if (finalAEList.includes('Norm')) {
|
|
||||||
tagList.push('<@U020KRBDSDQ>');
|
|
||||||
}
|
|
||||||
if (finalAEList.includes('Dan')) {
|
|
||||||
tagList.push('<@U01P7DTFSQZ>');
|
|
||||||
}
|
|
||||||
if (finalAEList.includes('Charles')) {
|
|
||||||
tagList.push('<@U01286MQUS2>');
|
|
||||||
}
|
|
||||||
if (finalAEList.includes('Travis')) {
|
|
||||||
tagList.push('<@UFE3T14UX>');
|
|
||||||
}
|
|
||||||
if (finalAEList.includes('Nick')) {
|
|
||||||
tagList.push('<@U0276LMA70F>');
|
|
||||||
}
|
|
||||||
if (finalAEList.includes('Mike')) {
|
|
||||||
tagList.push('<@U027MAQUPM0>');
|
|
||||||
}
|
|
||||||
if (finalAEList.includes('Doug')) {
|
|
||||||
tagList.push('<@U02CK55FHFX>');
|
|
||||||
}
|
|
||||||
if (finalAEList.includes('Isabel')) {
|
|
||||||
tagList.push('<@U03019S7R6F>');
|
|
||||||
}
|
|
||||||
if (finalAEList.includes('Ryan')) {
|
|
||||||
tagList.push('<@U0325CWA3N3>');
|
|
||||||
}
|
|
||||||
var tagUsers = tagList.toString();
|
|
||||||
/*
|
|
||||||
Now, we're building the payload for the Slack Message.
|
|
||||||
This is very specific and prone to errors, so check that it works using Slack's tool:
|
|
||||||
https://app.slack.com/block-kit-builder/
|
|
||||||
|
|
||||||
Copy from Rich:
|
|
||||||
":rotating_light::rotating_light::rotating_light: New Meeting Tracker Alert! :rotating_light::rotating_light::rotating_light:
|
|
||||||
It's your daily reminder to update the new meeting tracker.
|
|
||||||
If you've been tagged, please address this by EOD."
|
|
||||||
*/
|
|
||||||
let payloadText =
|
|
||||||
{
|
|
||||||
"blocks": [
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": ":rotating_light::rotating_light::rotating_light: New Meeting Tracker Alert! :rotating_light::rotating_light::rotating_light:"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": "It's your daily reminder to update the new meeting tracker."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": "If you've been tagged, please address this by EOD."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": finalAEList // Sends list with AE, meeting date, and company
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": "In case you need it, here's a link to the sheet. :point_right:"
|
|
||||||
},
|
|
||||||
"accessory": {
|
|
||||||
"type": "button",
|
|
||||||
"text": {
|
|
||||||
"type": "plain_text",
|
|
||||||
"text": "Sales New Meeting Tracker",
|
|
||||||
"emoji": true
|
|
||||||
},
|
|
||||||
"value": "sales_tracker_link_123",
|
|
||||||
"url": "https://docs.google.com/spreadsheets/d/150nSuHQLJHpJaYdQ6KHeN7nQ6iexwtnQEpicM77PK8A/edit#gid=0 | First Meeting Tracker",
|
|
||||||
"action_id": "button-action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "divider"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": tagUsers // Tags with slack user numbers if they appear in finalSend
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
// This is standard operating procedure to creating the payload and destination
|
|
||||||
const webhook = "https://hooks.slack.com/services/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";
|
|
||||||
const options = {
|
|
||||||
method: "post",
|
|
||||||
contentType: "application/json",
|
|
||||||
muteHttpExceptions: true,
|
|
||||||
payload: JSON.stringify(payloadText),
|
|
||||||
};
|
|
||||||
const sendMsg = UrlFetchApp.fetch(webhook, options);
|
|
||||||
var respCode = sendMsg.getResponseCode();
|
|
||||||
//Logger.log(sendMsg); // Debug to confirm send
|
|
||||||
//Logger.log(respCode); // Debug to show errors, if any
|
|
||||||
/*
|
|
||||||
This is the else statement that sends a certain message not tagging anyone and saying that data is clean.
|
|
||||||
*/
|
|
||||||
} else {
|
|
||||||
let noMeetingMsg =
|
|
||||||
{
|
|
||||||
"blocks": [
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": ":star::star::star: New Meeting Tracker Alert! :star::star::star:"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": "Good job, everyone! All meetings from the last 5 days are up to date. Keep doing what you're doing!"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
// This is standard operating procedure to creating the payload and destination
|
|
||||||
|
|
||||||
const webhook = "https://hooks.slack.com/services/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";
|
|
||||||
const options = {
|
|
||||||
method: "post",
|
|
||||||
contentType: "application/json",
|
|
||||||
muteHttpExceptions: true,
|
|
||||||
payload: JSON.stringify(noMeetingMsg),
|
|
||||||
};
|
|
||||||
const sendMsg = UrlFetchApp.fetch(webhook, options);
|
|
||||||
var respCode = sendMsg.getResponseCode();
|
|
||||||
|
|
||||||
//Logger.log(sendMsg); // Debug to confirm send
|
|
||||||
//Logger.log(respCode); // Debug to show errors, if any
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
function createEvent() {
|
|
||||||
let calendarID = '';
|
|
||||||
let eventName = '';
|
|
||||||
let startTime = '';
|
|
||||||
let endTIme = '';
|
|
||||||
let zoomLink = '';
|
|
||||||
var event = CalendarApp.getCalendarById(calendarID).create(
|
|
||||||
eventName, startTime, endTime, zoomLink);
|
|
||||||
eventID = event.getID();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function addLearner(eventID, calendarID) {
|
|
||||||
let attendeeEmail = '{{ current_person.email }}';
|
|
||||||
let calendarID = calendarID;
|
|
||||||
let eventID = eventID;
|
|
||||||
|
|
||||||
let calendar = CalendarApp.getCalendarById(calendarID);
|
|
||||||
if (calendar == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let event = calendar.getEventById(eventID);
|
|
||||||
if (event == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.addGuest(attendeeEmail);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
The point of this script is to start a timer for each email that comes in
|
|
||||||
and if the email goes unanswered after a certain amount of time
|
|
||||||
alert the owner of the account being monitored.
|
|
||||||
Hopefully, with a slack message.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var timerCount = 0;
|
|
||||||
var emailSubject = getSubject();
|
|
||||||
var emailTime = getDate();
|
|
||||||
var newEmail;
|
|
||||||
var emailInbox = isInInbox();
|
|
||||||
|
|
||||||
|
|
||||||
function startTImer() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMessage() {
|
|
||||||
if
|
|
||||||
}
|
|
||||||
|
|
||||||
function compileAlert() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendAlert() {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,109 +0,0 @@
|
|||||||
const sheetTwo = SpreadsheetApp.getActiveSheet();
|
|
||||||
var now = new Date();
|
|
||||||
var formatToday = Utilities.formatDate(now, 'America/New_York', 'MM/dd/yyyy');
|
|
||||||
|
|
||||||
function newMeetings() {
|
|
||||||
var startRow = 2; // First row of data to process
|
|
||||||
var numRows = sheetTwo.getLastRow()-1; // Number of rows to process
|
|
||||||
var dataRange = sheetTwo.getRange(startRow, 1, numRows, sheet.getLastColumn());
|
|
||||||
var data = dataRange.getValues();
|
|
||||||
var sdrMeeting = [];
|
|
||||||
|
|
||||||
for (i in data) {
|
|
||||||
var row = data[i];
|
|
||||||
var sdr = row[0]; // Column A
|
|
||||||
var date = Utilities.formatDate(row[3],'America/New_York','MM/dd/yyyy'); // Column D
|
|
||||||
var company = row[4]; // Column E
|
|
||||||
var outbound = row[5]; // Column F
|
|
||||||
let sdrMeetingListOne = [sdr, date, company, outbound];
|
|
||||||
if ((sdrMeetingListOne[1] == formatToday) && (sdrMeetingListOne[0] != '') && (sdrMeetingListOne[3] == "Outbound")) {
|
|
||||||
sdrMeetingListOne.toString();
|
|
||||||
sdrMeeting.push(sdrMeetingListOne);
|
|
||||||
Logger.log(sdrMeetingListOne)
|
|
||||||
} else if ((sdrMeetingListOne[1] == formatToday) && (sdrMeetingListOne[0] != '')) {
|
|
||||||
let noMeetingText =
|
|
||||||
{
|
|
||||||
"blocks": [
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": ":star: *C'mon team!* :star:"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "divider"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": "No new meetings today? We can do better than that! Hustle!"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
const webhook = "https://hooks.slack.com/services/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";
|
|
||||||
const options = {
|
|
||||||
method: "post",
|
|
||||||
contentType: "application/json",
|
|
||||||
muteHttpExceptions: true,
|
|
||||||
payload: JSON.stringify(noMeetingText),
|
|
||||||
};
|
|
||||||
const sendMsg = UrlFetchApp.fetch(webhook, options);
|
|
||||||
var respCode = sendMsg.getResponseCode();
|
|
||||||
Logger.log(sendMsg);
|
|
||||||
Logger.log(respCode);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Logger.log(sdrMeeting);
|
|
||||||
var toSend = sdrMeeting.splice(1).join('\n');
|
|
||||||
var getEm = toSend.replace(/,/g, ' - ')
|
|
||||||
Logger.log(getEm);
|
|
||||||
let payloadMeetingText =
|
|
||||||
{
|
|
||||||
"blocks": [
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": ":star: *Pitter Patter!* :star:"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "divider"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": "Here's who has meetings today. Get after it boys and girls!"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"text": {
|
|
||||||
"type": "mrkdwn",
|
|
||||||
"text": getEm
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "image",
|
|
||||||
"image_url": "https://media.giphy.com/media/3ohjURBuAtWDV8d3SE/giphy.gif",
|
|
||||||
"alt_text": "inspiration"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
//(array[0] + ", you still need to fill out the cells for" + array[2] + " from " + array[1] + "!\n");
|
|
||||||
const webhook = "https://hooks.slack.com/services/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";
|
|
||||||
const options = {
|
|
||||||
method: "post",
|
|
||||||
contentType: "application/json",
|
|
||||||
muteHttpExceptions: true,
|
|
||||||
payload: JSON.stringify(payloadText),
|
|
||||||
};
|
|
||||||
const sendMsg = UrlFetchApp.fetch(webhook, options);
|
|
||||||
var respCode = sendMsg.getResponseCode();
|
|
||||||
Logger.log(sendMsg);
|
|
||||||
Logger.log(respCode);
|
|
||||||
};
|
|
||||||
@ -1,127 +0,0 @@
|
|||||||
/* Pertinent Information and Codes:
|
|
||||||
Custom Fields:
|
|
||||||
Channel = customfield_10121
|
|
||||||
Campaign = customfield_10120
|
|
||||||
SDR = customfield_10122
|
|
||||||
Start Date = customfield_10015
|
|
||||||
|
|
||||||
Users:
|
|
||||||
Travis Nardin = 5d9cb42c0265ca0db955b965
|
|
||||||
Dan Peski = 603318815ddf020069969cad
|
|
||||||
Norm Rasmussen = 6092af20d353800068863d15
|
|
||||||
Michael Valido = 61fbf60cd8d7cf006a90941c
|
|
||||||
Jon Newfield = 6092af212c2f6c0068ec92c4
|
|
||||||
Isabel Katz = 620145241fec260068c107e5
|
|
||||||
Charles McGovern = 5eaaf1c4021ae30ba8fcb184
|
|
||||||
Nick Zuppe = 60eddda64257a90070aeebef
|
|
||||||
Doug Goldsmith = 61294a4845f753006951a590
|
|
||||||
Nick Appleby = 6183eab7892c420072f9c437
|
|
||||||
Quba Williams-Wilfong = 62101fe4e41f76006a6f6510
|
|
||||||
|
|
||||||
Without accounts: Adan, Drew
|
|
||||||
|
|
||||||
*/
|
|
||||||
var count = 0;
|
|
||||||
var list;
|
|
||||||
var finalEntry;
|
|
||||||
|
|
||||||
function myFunction() {
|
|
||||||
var URL = "https://northpass.atlassian.net/rest/api/3/issue/";
|
|
||||||
// var accountID = "6092af20d353800068863d15";
|
|
||||||
var token = "2NrKYv22TLWnxTo7EhU3633E";
|
|
||||||
// var UserCredentials = Utilities.base64Encode(accountID + ":" + token);
|
|
||||||
var user = "nrasmussen@northpass.com";
|
|
||||||
// var pass = "c9QK\>4^fxiHt!";
|
|
||||||
var UserCredentials = Utilities.base64Encode(user + ":" + token);
|
|
||||||
|
|
||||||
// Setting up data range and empty arrays
|
|
||||||
const sheet = SpreadsheetApp.getActiveSheet();
|
|
||||||
var startRow = 1; // First col of data to process
|
|
||||||
var numRows = 1132; // Number of rows to process
|
|
||||||
var dataRange = sheet.getRange(startRow, 1, numRows, sheet.getLastColumn()).getValues();
|
|
||||||
|
|
||||||
for (col in dataRange) { // For a data col within the entire data range
|
|
||||||
var col = dataRange[col];
|
|
||||||
let sdr = col[0]; // Column - A
|
|
||||||
let name = col[1]; // Column - B
|
|
||||||
let rawDate = Utilities.formatDate(col[3], 'America/New_York', 'yyyy-MM-dd');
|
|
||||||
let bookingDate = Utilities.formatDate(col[2], 'America/New_York', 'MM/dd/yyyy'); // Column - C
|
|
||||||
let meetingDate = Utilities.formatDate(col[3], 'America/New_York', 'MM/dd/yyyy'); // Column - D
|
|
||||||
let company = col[4]; // Column - E
|
|
||||||
let channel = col[5]; // Column - F
|
|
||||||
let result = col[7]; // Column - H
|
|
||||||
let campaign = col[8]; // Column - I
|
|
||||||
let info = col[9]; // Column - J
|
|
||||||
let list = [sdr, name, rawDate ,bookingDate, meetingDate, company, channel, result, campaign, info];
|
|
||||||
list.toString();
|
|
||||||
let sdrDict = {
|
|
||||||
"Mike" :
|
|
||||||
"61fbf60cd8d7cf006a90941c",
|
|
||||||
"Nick" :
|
|
||||||
"60eddda64257a90070aeebef",
|
|
||||||
"Appleby" :
|
|
||||||
"6183eab7892c420072f9c437",
|
|
||||||
"Doug" :
|
|
||||||
"61294a4845f753006951a590",
|
|
||||||
"Quba" :
|
|
||||||
"62101fe4e41f76006a6f6510",
|
|
||||||
};
|
|
||||||
if (list.includes("Unqork")) {
|
|
||||||
var data = {
|
|
||||||
"fields": {
|
|
||||||
"project": {
|
|
||||||
"key": "NPIPE",
|
|
||||||
},
|
|
||||||
"issuetype": {
|
|
||||||
"id": "10071",
|
|
||||||
},
|
|
||||||
"summary": list[5],
|
|
||||||
"description": {
|
|
||||||
"type": "doc",
|
|
||||||
"version": 1,
|
|
||||||
"content": [
|
|
||||||
{
|
|
||||||
"type": "paragraph",
|
|
||||||
"content": [
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"text": "Booked Date - " + list[3] + '\n' +
|
|
||||||
"Meeting Date - " + list[4] + '\n' +
|
|
||||||
"Description from Tracker: " + list[9] + '\n' +
|
|
||||||
"Last Status - " + list[7]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"customfield_10015": list[2], // Start (Meeting) Date - rawDate
|
|
||||||
"customfield_10127": [ // Campaign
|
|
||||||
list[8]
|
|
||||||
],
|
|
||||||
"customfield_10129": [{"id" : sdrDict[list[0]]}], // SDR
|
|
||||||
"customfield_10128": [ // Channel
|
|
||||||
list[6]
|
|
||||||
],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
payload = JSON.stringify(data);
|
|
||||||
Logger.log(payload);
|
|
||||||
var headers = {
|
|
||||||
"Accept": "application/json",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Authorization": "Basic " + UserCredentials,
|
|
||||||
"muteHttpExceptions": true,
|
|
||||||
}
|
|
||||||
var options = {
|
|
||||||
"method": "POST",
|
|
||||||
"headers": headers,
|
|
||||||
"payload": payload
|
|
||||||
}
|
|
||||||
//Logger.log(options);
|
|
||||||
var response = UrlFetchApp.fetch(URL, options);
|
|
||||||
//Logger.log(response);
|
|
||||||
var respCode = response.getResponseCode();
|
|
||||||
//Logger.log(respCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
function doGet(e) {
|
|
||||||
return HtmlService.createHtmlOutput("get request received");
|
|
||||||
}
|
|
||||||
|
|
||||||
//this is a function that fires when the webapp receives a POST request
|
|
||||||
function doPost(e) {
|
|
||||||
var params = JSON.stringify(e.postData.contents);
|
|
||||||
params = JSON.parse(params);
|
|
||||||
var now = new Date();
|
|
||||||
var timeAdded = Utilities.formatDate(now,'America/New_York','MM/dd/yyyy');
|
|
||||||
|
|
||||||
var learnerName = params.substring(params.indexOf('{"name":"') + 7, params.lastIndexOf('"email"'));
|
|
||||||
learnerName = learnerName.slice(learnerName.indexOf('"') + 1, learnerName.lastIndexOf('"'),);
|
|
||||||
Logger.log("Name = " + learnerName);
|
|
||||||
|
|
||||||
var learnerEmail = params.substring(params.indexOf('"email":"') + 9, params.lastIndexOf('"full_name"'));
|
|
||||||
learnerEmail = learnerEmail.slice(learnerName.indexOf('"') + 1, learnerEmail.lastIndexOf('"'),);
|
|
||||||
Logger.log("Email = " + learnerEmail);
|
|
||||||
|
|
||||||
var courseName = params.substring(params.indexOf('"course_name":"') + 4, params.lastIndexOf('"attributes"'));
|
|
||||||
courseName = courseName.slice(courseName.indexOf('"') + 3, courseName.lastIndexOf('"'),);
|
|
||||||
Logger.log("Course = " + courseName);
|
|
||||||
|
|
||||||
var activityName = params.substring(params.indexOf('"title":"') + 4, params.lastIndexOf('"course_name"'));
|
|
||||||
activityName = activityName.slice(activityName.indexOf('"') + 3, activityName.lastIndexOf('"'),);
|
|
||||||
Logger.log("Activity = " + activityName);
|
|
||||||
|
|
||||||
var dateCompleted = params.substring(params.indexOf('"updated_at":"') + 4, params.lastIndexOf('"activated_at"'));
|
|
||||||
dateCompleted = dateCompleted.slice(dateCompleted.indexOf('"') + 3, dateCompleted.lastIndexOf('"'),);
|
|
||||||
Logger.log("Completed on = " + dateCompleted);
|
|
||||||
|
|
||||||
var sheet = SpreadsheetApp.getActiveSheet();
|
|
||||||
var lastRow = Math.max(sheet.getLastRow(),1);
|
|
||||||
|
|
||||||
sheet.insertRowAfter(lastRow);
|
|
||||||
sheet.getRange(lastRow + 1, 1).setValue(timeAdded);
|
|
||||||
sheet.getRange(lastRow + 1, 2).setValue(params);
|
|
||||||
sheet.getRange(lastRow + 1, 3).setValue(learnerName);
|
|
||||||
sheet.getRange(lastRow + 1, 4).setValue(learnerEmail);
|
|
||||||
sheet.getRange(lastRow + 1, 5).setValue(courseName);
|
|
||||||
sheet.getRange(lastRow + 1, 6).setValue(activityName);
|
|
||||||
sheet.getRange(lastRow + 1, 7).setValue(dateCompleted);
|
|
||||||
|
|
||||||
|
|
||||||
SpreadsheetApp.flush();
|
|
||||||
return HtmlService.createHtmlOutput("post request received");
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user