Skip to main content
Version: 1.x.x

Storing User Preferences

Most of your app's data will be stored in Records tied to specific app instances. But sometimes, you may need to store data associated with a user that is shared across different instances of your app.

User preferences allow your app to store user-specific data for the viewing user, accessible to your app only. All preference keys and values must be strings.

Save a preference:

var prefs = quip.apps.getUserPreferences();
prefs.save({favoriteDog: "Leo", favoriteArtist: "Carly Rae Jepsen");
prefs.save({favoriteColor: "teal"});

Only keys included in the prefs dictionary are modified — all other keys are preserved unless they are explicitly set to undefined.

Read a specific preference, then clear it:

var prefs = quip.apps.getUserPreferences();
var color = prefs.getForKey("favoriteColor");
prefs.save({favoriteColor: undefined});

Read all preferences, then clear all:

var prefs = quip.apps.getUserPreferences();
var all = prefs.getAll();
var faveArtist = all.favoriteArtist;
prefs.clear();

See Preferences for a full description of the APIs.