In the fast-paced world of business, reacting quickly and efficiently to changes is paramount. Whether it's a new customer order, a database update, or a sensor reading, events are constantly happening across your systems. But how do you ensure these events automatically kick off the right actions and processes within your organization? Enter Triggers.do, the platform designed for event-based workflow automation that lets you start workflows when events happen.
Triggers.do is more than just another automation tool; it's a powerful platform for workflow initiation and process orchestration that leverages real-time events. Instead of relying on scheduled tasks or manual intervention, Triggers.do enables your business processes to dynamically react to incoming information, creating truly responsive and efficient operations.
Ready to see the power of real-time automation in action? Let's dive into a simple code example using Triggers.do and explore how easy it is to set up your first event trigger.
Triggers.do provides a clean and intuitive way to define triggers programmatically. Here's a look at a basic example using the TypeScript language, the code snippet provided by Triggers.do:
import { Trigger } from 'triggers.do';
const newOrderTrigger = new Trigger({
name: 'New Order Created',
description: 'Triggers when a new order is created in the system',
event: 'order.created',
source: 'ecommerce-platform',
filter: {
condition: 'amount > 100',
priority: 'high'
},
handler: async (event) => {
// Process the event and start workflows
return {
workflowId: 'order-processing',
data: event.data
};
}
});
Let's break down this code step-by-step:
import { Trigger } from 'triggers.do';: This line imports the necessary Trigger class from the Triggers.do library, which is the foundation for defining your event listeners.
const newOrderTrigger = new Trigger({...});: Here, we create a new instance of the Trigger class, assigning it to the variable newOrderTrigger. The configuration for this trigger is passed as an object to the constructor.
name: 'New Order Created': A descriptive name for your trigger. This helps you easily identify the trigger within the Triggers.do platform.
description: 'Triggers when a new order is created in the system': A more detailed explanation of what this trigger does. Good descriptions are crucial for maintaining clarity as your triggers grow.
event: 'order.created': This is the core of the trigger definition. It specifies the specific event that this trigger is listening for. In this case, it's an event named order.created. Triggers.do is designed to handle a wide variety of custom and standard event names.
source: 'ecommerce-platform': This indicates the system or origin from which the event is expected to come. By specifying a source, you can ensure your triggers are reacting to events from the correct system, such as your e-commerce platform, CRM, or custom application.
filter: { condition: 'amount > 100', priority: 'high' }: This is where the true power of event triggers comes in! Triggers.do allows you to filter events based on their data. In this example, the trigger will only fire if the amount property within the event data is greater than 100. This allows you to be highly selective about which events initiate workflows. You can also assign priority levels to your triggers.
handler: async (event) => { ... }: This is the function that will be executed when a matching event occurs and passes the filter conditions. This is where you define the actions that should be taken.
// Process the event and start workflows: This is a comment indicating where you would add your logic to process the incoming event data.
return { workflowId: 'order-processing', data: event.data };: The handler function is expected to return an object that tells Triggers.do which workflow to start and what data to pass to it. In this case, it's instructing Triggers.do to initiate the workflow with the ID order-processing and pass the original event data to it. This is the core of workflow initiation within Triggers.do.
This simple example demonstrates the fundamental components of defining a trigger in Triggers.do. By leveraging key attributes like event, source, and filter, you can create highly specific and responsive triggers that drive your automated processes.
Moving to event-based automation with Triggers.do offers significant advantages:
Setting up your first trigger is just the beginning. With Triggers.do, you can define countless triggers to automate workflows for a wide array of scenarios. Whether it's automating customer onboarding upon sign-up, initiating stock replenishment when inventory levels drop, or notifying a team when a critical error occurs, Triggers.do provides the flexible and powerful platform to make it happen.
Ready to experience the power of AI Workflow Ignition and event-based automation for yourself? Start exploring the possibilities with Triggers.do and take the first step towards truly reactive and efficient business process automation.