Event History
The Event History node in Magick allows you to retrieve a historical record of events that have occurred within a flow. This node is particularly useful for debugging, auditing, or analyzing the behavior of your flows over time.Inputs
flow(required): The input flow containing the events to retrieve the history for.entries(optional, default: 10): The number of historical event entries to retrieve.
Outputs
flow: The original input flow, passed through unchanged.events: An array of event objects representing the historical events.strings: An array of formatted strings representing the historical events in a human-readable format.
Configuration Options
hiddenProperties(default:["hiddenProperties", "eventState", "availableEvents"]): An array of property names to exclude from the output event objects.eventState(default:["sender", "agentId"]): An array of event state properties to include in the output event objects.eventStateProperties(default:["client", "connector", "channel", "from user", "to user"]): An array of additional event state properties to include in the output event objects.availableEvents(default:["messageReceived", "webhookReceived", "messageSend", "messageStream"]): An array of event types that are available for selection.selectedEvents(default:[]): An array of specific event types to include in the output. If empty, all available event types will be included.
Usage
- Connect a flow containing events to the
flowinput of the Event History node. - (Optional) Specify the desired number of historical event entries to retrieve using the
entriesinput. The default is 10. - (Optional) Customize the configuration options to control which event properties and types are included in the output.
- The node will output the original
flow, an array ofeventsobjects representing the historical events, and an array ofstringscontaining a human-readable representation of the events.
Example
Here’s an example of how to use the Event History node in a Magick spell:Best Practices
- Use the Event History node judiciously, as retrieving large amounts of historical data can impact performance. Start with a smaller
entriesvalue and increase it only if necessary. - Be selective about which event types and properties you include in the output to avoid unnecessary data retrieval and processing.
- Use the
stringsoutput for human-readable logging and debugging, while theeventsoutput is more suitable for programmatic processing.
Common Issues
- If the
eventsorstringsoutputs are empty, ensure that the connected flow has actually processed events and that theselectedEventsconfiguration matches the event types present in the flow. - If the retrieved events don’t contain the expected properties, review the
eventStateandeventStatePropertiesconfiguration options to ensure the desired properties are included.
