Skip to main content
The API object for the send-phone-message Actions trigger exposes methods for managing the cache.

api.cache

Store and retrieve data that persists across executions.
api.cache.delete(key)
void
Delete a cached record at the supplied key if it exists.
Example
exports.onExecuteSendPhoneMessage = async (event, api) => {
  api.cache.delete('my-key');
};
Parameters
api.cache.get(key)
object | undefined
Retrieve a cached record at the supplied key. If found, access the value via record.value.
Example
exports.onExecuteSendPhoneMessage = async (event, api) => {
  const record = api.cache.get('my-key');
  if (record) console.log(record.value);
};
Parameters
api.cache.set(key, value, options)
void
Store or update a string value in the cache at the specified key. Values are scoped to the Trigger and subject to the Actions Cache Limits. If no lifetime is specified, a default lifetime of 15 minutes will be used.Important: This cache is designed for short-lived, ephemeral data. Items may not be available in later transactions even if they are within their supplied lifetime.
Example
exports.onExecuteSendPhoneMessage = async (event, api) => {
  api.cache.set('my-key', 'my-value', { ttl: 60000 });
};
Parameters