context.setData('scope', 'visibility', 'key', 'value') - storing addon data in a specific invocation context (currently, all available sections of the add-ons are within a card, so the data is saved only in the context of the card or of the user)
| argument | Type | Description |
|---|---|---|
| scope | string | Invocation context. Currently, 'card' and 'user'. |
| visibility | string | One of - private or shared: private - data is saved only for the current user, other users won't see the data. shared - data is saved for all users and will be visible to any authorized user. note - in user scope data can be stored only as private |
| key | string | The key under which the data will be saved |
| value | any | Value |
Return value - Promise
Instead of a key and value, you can also pass an object to save more than one value at a time.
await context.setData('card', 'private', { first: 1, second: 2 })
await context.setData('user', 'private', 'key', 'value')