Skip to main content
The API object for the custom-email-provider Actions trigger includes the following:

api.cache

Store and retrieve data that persists across executions.

api.cache.delete(key)

Delete a record describing a cached value at the supplied key if it exists. Returns a CacheWriteResult object with type: "success" if a value was removed from the cache. A failed operation returns type: "error". For errors, the returned object has a code property that indicates the nature of the failure.
ParameterTypeDescription
keyStringThe key of the record stored in the cache.

api.cache.get(key)

Search the cache for an entry matching the supplied key. Returns a cache record if a matching item is found. Cache records are objects with a value property containing the cached value and an expires_at property containing the maximum expiry of the record in milliseconds since the Unix epoch.
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.
ParameterTypeDescription
keyStringThe key of the record stored in the cache.

api.cache.set(key, value, [options])

Store or update a string value in the cache at the specified key. Values stored in this cache are scoped to the Trigger in which they are set. They are subject to the Actions Cache Limits. Values stored in this way will have lifetimes of up to the specified ttl or expires_at values. If no lifetime is specified, a default of lifetime of 15 minutes will be used. Lifetimes may not exceed the maximum duration listed at Actions Cache Limits.
ParameterTypeDescription
keyStringThe key of the record stored in the cache.
valueStringThe value of the record to be stored.
optionsOptional objectOptions for adjusting cache behavior.
options.expires_atOptional numberThe absolute expiry time in milliseconds since the Unix epoch. While cached records may be evicted earlier, they will never remain beyond the supplied expires_at. If both options.expires_at and options.ttl are included, the earlier expiry of the two is used.
options.ttlOptional numberThe time-to-live value of this cache entry in milliseconds. While cached records may be evicted earlier, they will never remain beyond the the supplied expires_at. If both options.expires_at and options.ttl are included, the earlier expiry of the two is used.

api.notification

Set a failed notification event to be either retried or dropped. If multiple calls are made, the last one is used.

api.notification.drop(reason)

When called, the notification event is considered failed without recovery. We log an error for the event (fn) and do not send it to the Action again.
ParameterTypeDescription
reasonOptional StringIncluded as part of the log entry to help you analyze the error further. This field is limited to 1024 characters and will be truncated if longer.

api.notification.retry(reason)

When called, the notification event is considered failed but recoverable. We log an error for this event (fn) and retry it up to 5 times in the next few minutes.
ParameterTypeDescription
reasonOptional StringIncluded as part of the log entry to help you analyze the error further. This field is limited to 1024 characters and will be truncated if longer.