Last active
August 10, 2016 20:51
-
-
Save parhelium/42df83da68639780218e2b95424ceeac to your computer and use it in GitHub Desktop.
Google Form and Drip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; | |
var drip_base_url = 'https://api.getdrip.com/v2/xxxxxxx/' | |
var drip_account_id = ‘xxxxxxxxxx'; | |
/** | |
* Uses the Drip API to record event | |
* https://www.getdrip.com/docs/rest-api#events | |
*/ | |
function recordEvent(fn, ln, em, yr){ | |
var payload = { | |
}; | |
var options = { | |
"method": "post", | |
"payload": payload | |
}; | |
var response = UrlFetchApp.fetch(mc_base_url,options); | |
Logger.log(response) | |
} | |
function onFormSubmit(e) { | |
var fname = e.namedValues['Name'][0].split(" ")[0]; | |
var lname = e.namedValues['Name'][0].split(" ")[1]; | |
var email = e.namedValues['Email'][0]; | |
var year = e.namedValues['Year'][0]; | |
recordEvent(fname,lname, email, year) | |
} | |
/** | |
* Main function. Creates onFormSubmit trigger. | |
*/ | |
function myFunction(){ | |
// Was separated line by line for debugging purposes. | |
var sheet = SpreadsheetApp.getActive(); | |
var a = ScriptApp.newTrigger("onFormSubmit"); | |
var b = a.forSpreadsheet(sheet); | |
var c = b.onFormSubmit(); | |
var d = c.create(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment