OpenBadges.me Google Apps Script
Google Apps Scripts for OpenBadges.me containing add-on for Google Forms.
- How to install
- Build your own
- Google Apps Script limitations
These add-ons can be used to create activity events which are simply records that something has happened. Using OpenBadges.me you can setup rules and automatically issue badges to your users when rule conditions have been met by the activity events.
This add-on allows you to create an activity event when a form has been completed.
This add-on allows you to create many activity events and is manually triggered and processed. The add-on can use tracking columns which requires rows to be verified before they are processed.
How to install
Build your own
Clone this repository.
npm installto install the dependencies for the add-ons.
.envfile in the same folder as the
.env.exampefile with the following keys:
Key Description SENDGRID_URL The URL for SendGrid's mail send API. SENDGRID_KEY Your private SendGrid API key. ERROR_EMAIL The email address which error emails should be sent from.
npm run buildto transpile and bundle the add-ons.
Copy the code from
distto Google Apps Scripts.
Google Apps Script limitations
Google Apps Script has some limitations which you should be aware of if you're planning on developing or contributing.
If an add-on requires access to the
OnFormSubmit event trigger, the add-on will require full authorization permissions which can only be obtained by installing the add-on from the Google Marketplace and following the authorization workflow.
This limitation can be seen in the Forms add-on which means you will have to install the MyKnowledgeMap version from the marketplace or deploy your own to the marketplace to test and use this trigger.
If the add-on does not require access to triggers (or it will be manually triggered by the user) you should find that it is easier to develop and test. An example of this can be seen in the Sheets add-on which uses a manual trigger to start the processing.
Google Apps Script does not natively support ES6+ or Typescript. You can transpile Typescript or ES6+ to ES5 which should run provided that you are targeting the correct ECMAScript version when transpiling, some features will not still not work however.
These add-ons are written in Typescript and transpiled to ES5 using Babel with the help of a few plugins to support running in the GAS environment.
- babel-plugin-transform-object-assign (adds polyfill for Object.assign)
- babel-plugin-transform-remove-export (removes export statements).
- babel-plugin-transform-html-import-to-string (html imports become inline strings).
- babel-plugin-transform-inline-environment-variables (env variables are replaced with build-time values).
Google Apps Script has limits on the usage of various Google services and APIs. These can be seen on the quota limits page.
The Forms add-on uses a work-around the quota limit for sending emails using the default Google MailApp and instead sends emails using the SendGrid API, this can easily be modified to use any other mail service or use the default Google MailApp.