In many cases, you will need to access all the digested events payload in order to show the user all or parts of the events included in this digest.For example: “John and 5 others liked your photo.”The digest function returns an array of triggers that have been digested.
You can use this array to perform any necessary actions on the digested triggers.
Like Sending and email, or updating a database.
Copy
Ask AI
const { events } = await step.digest("digest-3-days", async () => { return { unit: "days", // 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' amount: 3, // the number of units to digest events for };});await step.email("send-email", async () => { const eventCount = events.length; return { subject: "Digest Email", body: `You have ${eventCount} new events`, };});
Step controls: At the moment, it is not possible to use digest information in step controls. You can only use it from the code, by creating a custom component for handling digested data.
The digest step returns an object with events array. Each event in the array has the following properties:
id - The job id of the digested event
time - The time when the event was triggered
payload - The original payload passed to the event
Changing the step content after triggering the workflow with digest step will not affect the existing digested events.