Loading
Help

StoreClient (Javascript)

Last updated:

Storing and retrieving data with StoreClient is very simple.

There is no need to require it - it comes pre-imported in your Code environment.

You will need to provide a secret that will protect your data. I recommend using Random.org's excellent password generator. Be very sure you pick a complex secret - if anyone guesses it they'll be able to read and write your data!

Instantiating a client is very simple:

var store = StoreClient('your secret here');

StoreClient is a promise based library and a great time to get familiar with async and await!

Most likely you just want to get and set some values - this is the simplest possible example:

const store = StoreClient('your secret here');
await store.set('hello', 'world');
const value = await store.get('hello');
return {result: value} // value === 'world'

If the value doesn't exist during your get() call - it will return a null value.

Bulk Operations

You can also save and retrieve multiple keys and values - a slightly more complex example:

const store = StoreClient('your secret here');
await store.setMany({hello: 'world', foo: 'bar'})
const values = await store.getMany('hello', 'foo');
// values === {hello: 'world', foo: 'bar'}
await store.deleteMany('hello', 'foo');
// or, if you want to wipe everything
await store.clear();

Note, you can call getMany and deleteMany in a few different ways:

store.getMany('hello', 'foo'); // as arguments
store.getMany(['hello', 'foo']); // as array
store.getMany({hello: null, foo: null}); // as object

API

You can also access the stored data via our store API. More info at https://store.zapier.com/

Limitations

  • Any JSON serializable value can be saved.
  • The secret must be under 32 chars in length.
  • Every key must be under 32 chars in length.
  • Every value must be under 250 kb.
  • Only 500 keys may be saved per secret.
  • Keys will expire if you do not touch them in 3 months.

Need More Help?

Contact Support

Tell us about your problem, and we’ll find you a solution or you can email support.
Get Help

Hire an Expert

We have a directory of professionals across the globe who are ready to help.
Find a Zapier Expert

Zapier Community

Connect with other Zapier users and industry professionals to get help crafting the perfect workflow.
Check out the community