The world of AI applications is increasingly dynamic and responsive. To build truly intelligent systems, your AI agents and workflows need the ability to react instantly to a multitude of events. This is where the power of triggers comes in. With trigger.do, you can seamlessly connect external events to your internal AI processes, creating responsive, agentic workflows that start exactly when you need them to.
Imagine an AI agent designed to welcome new users to your platform. Without a trigger, you'd have to manually initiate this process or rely on scheduled checks, which can be inefficient. With trigger.do, you can automatically launch this workflow the moment a new user signs up, providing a personalized and immediate experience.
trigger.do makes this effortless. It allows you to easily trigger events and actions within your AI applications and services via simple API calls. Whether it's a new user registration, a change in data, an external notification, or a command from another service, trigger.do acts as the catalyst, ensuring your AI workflows are always ready to respond.
At its core, trigger.do provides an API endpoint that acts as a gateway to any process or action defined within your .do environment. Think of your .do projects as a collection of potential actions, workflows, or agentic behaviors. trigger.do gives you the key to unlock and initiate any of these on demand.
Here's a simplified view of the process:
This event-driven architecture allows your AI applications to be highly reactive and efficient, only consuming resources when an event demands a response.
Let's look at a basic example using the trigger.do SDK:
import { Do } from "@do/sdk";
const doClient = new Do({
apiKey: "YOUR_API_KEY"
});
async function triggerWorkflow() {
try {
const result = await doClient.trigger(
"your-workflow-id", // Replace with the actual ID from your .do platform
{
payload: {
"user_id": "abc123",
"event_type": "user_registered"
}
}
);
console.log("Trigger successful:", result);
} catch (error) {
console.error("Failed to trigger workflow:", error);
}
}
triggerWorkflow();
In this TypeScript example, we initialize the trigger.do SDK with our API key. The triggerWorkflow function then calls the doClient.trigger method, providing the unique ID of the workflow we want to start ("your-workflow-id") and a payload object containing data about the event (a user ID and the event type). The triggered workflow within your .do environment would then receive this payload and act accordingly – perhaps sending a welcome email to user "abc123".
What is trigger.do? trigger.do allows you to initiate any process, workflow, or action defined within your .do environment by making a simple API call.
Can I pass data when triggering an event? Yes, you can pass custom data payloads with your trigger calls to provide context and information for the initiated workflow or action.
How do I find the ID of the workflow or action I want to trigger? You can find your unique workflow or action IDs within the .do platform interface.
trigger.do is a fundamental component for building responsive and intelligent AI applications. By embracing an event-driven approach, you can create more dynamic, efficient, and powerful agentic workflows. Ready to get started? Explore the .do platform and begin triggering your workflows today.