Gmail add-ons: Conditional Homepage Content
There may be times when you want to present different content in your add-on's homepage depending on certain conditions. For example, I want to present a card to the user when they run my add-on for the first time (I'll call it 'card-A'), but present a different card for each subsequent time the add-on is run ('card-B'). I will need to keep track somehow, so I will use apps-script's property service to retain the information. (Note: for this example, I will use script property service, but you will probably want to use user property service for each individual user if anyone else will be using the add-on). function onHomepage () { //The first thing to do is get the script properties and check the content: const scriptProperties = PropertiesService . getScriptProperties (); const runStatus = scriptProperties . getProperty ( 'first_run' ); //After giving it some th...