userSettings.*

Allows access to the settings specified by the script user.

const value = userSettings.someUserVar;

Output

Provides access to user-defined settings as an object.
Each key corresponds to a user-configurable variable.

Comments

userSettings are intended primarily for scripts distributed through the Bots Store,
but can also be used in your own private scripts.

You can use them to create configurable behavior for your scripts based on user preferences.

Example: Setting Defaults

An easy way to set default values is by using Object.assign().

// Define the default settings here.
const defaultSettings = {
  greetingMessage: "Hello, welcome!",
  repeatCount: 2,
  enableLogging: false
};

// Merge defaults with any values provided by the user.
const settings = Object.assign({}, defaultSettings, userSettings);

// Access the settings.
console.log(settings.greetingMessage);

Learn More

See the User Settings reference for details on defining and managing user-configurable settings.