Getting started with Ephemeral Exchange for push notification

What is Ephemeral Exchange

efx is a cross platform cache, based on Firestore, that can be used to exchange data between unconnected platforms. It has push notification, which means that co-operating processes can be informed when something interesting happens. This is the mechanism you'll use to have the Sheets UI notify your add-on when there's a change. 
Ephemeral exchange keys
There are 3 main types of keys
  • Boss - these are used to create access keys, and should be kept private. They are generated in the Ephemeral Exchange console
  • Access keys - writer, reader and update keys allow writing and reading of data items in the store. The reader and updater keys are meant to be shared with collaborators. 
  • Item keys - these are keys associated with a data item. To be able to read a data item you need to have an access key that has been allowed to access it.

Getting started with Ephemeral exchange

 Ephemeral exchange uses a system of expiring keys to provide access to cached data. To register, just sign in to using your Google credentials - that will automatically create an account for you.

Next add a boss key and copy it - this is what you'll use to control access to the store

Storing the boss key

Best to store that in your property store of your script.


To standardize and tailor access for Sheets push notification, you can use this library, cSheetEfx which contains all you'll need.

Making keys

In addition to the boss key, you'll need access keys. You can create them using the API yourself, but the cSheetEfx can do it for you. Here's how to create them and store them in a property store. 
// example fo how to make keys
// assuming I have my boss key in property store
function makeNewKeys () {

  const sf = cSheetEfx.SheetEfx;
  const keys = sf.generateKeys (PropertiesService.getScriptProperties().getProperty("efx_bosskey"));
  // now write these somewhere that corresponds with the fetchkeys place
  PropertiesService.getScriptProperties().setProperty ("sf_efx_keys" , JSON.stringify(keys));


Now the property store contains all the necessary keys and efx is all set up and ready to be used for push notification in your add-on.

For more like this, see Google Apps Scripts snippets. Why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.