Example Use Case: Google Forms to Aptible Comply

This article gives an example of how data entered into a Google Form can be pushed into Aptible Comply using Google Apps Script. The "tags" can be interrogated by an Automation and drive specific alerts if the Event is logged as an "Issue" based on the rules configured within Aptible.


Example Script

This is an example script and assumes prior knowledge of Google Apps Scripts. The security and performance of Events API actions are ultimately the responsibility of the Aptible customer. Our team is always looking to document and learn about novel use cases for the API, so please reach out to your CSM for support and with feedback.

The example script is for taking the responses to a security training form, and logging it as evidence. Other examples of Google Forms that could have relevance for security/compliance processes include:

  • Security incident reporting
  • Customer complaints
  • Access requests
  • Employee onboarding and offboarding requests

While this example is for Google Apps Script and a Google Form, a similar flow will happen regardless of what external data source is being connected to Aptible. The data will need to be processed/structured and then posted at the endpoint.

//Google Apps Script (based on JavaScript) takes the results of a completed Google Form and posts it into Aptible as evidence

function SubmitGoogleFormData(e) { 
  try {

// Get the columns
        ss = SpreadsheetApp.getActiveSheet(),        // get the active sheet
        lr = ss.getLastRow(),                        // get the last row
        resp = ss.getRange(lr, 2, 1, 1).getValue(),  // column 2 response
        user = ss.getRange(lr, 3, 1, 1).getValue(),  // column 3 Email Address
        notes = ss.getRange(lr, 4, 1, 1).getValue(),  // column 4 Notes
// Create the payload
          payload = {
            'event': {
              'tags': [resp],
              'event_asset_ids': [user],
              'event_type': 'Completed Security Annual Training',
              'payload': [notes]             }
// Set up authorization
var headers = {
    'X-API-KEY': 'events_api_key',// Replace with evebts_api_key key for Aptible Program you would like to connect to

// build call
var call = {
      'method': 'post',
      'contentType': 'application/json',
      'headers': headers,
      'payload': JSON.stringify(payload),
// Set API method URL
    var url = "https://comply-api.aptible.com/api/v1/events";
// Make the call
    var response = UrlFetchApp.fetch(url, call);
// Log the response (useful for debugging)
    Logger.log(JSON.stringify(response), call);
  } catch (error) {
    Logger.log(error.toString(), call);