Are you building AI applications, agentic workflows, or any system that relies on initiating actions based on events? The .do platform, powered by trigger.do, makes it simple to activate these workflows and actions programmatically. With the powerful .do SDK, you can seamlessly integrate event triggering directly into your code.
Imagine having a central platform where you define complex automation, from sending personalized emails when a user signs up, to triggering an AI agent to process an image when it's uploaded. trigger.do is the engine that allows you to kickstart these processes from anywhere in your application or service.
It all boils down to this: easily trigger events and actions within your AI applications and services via simple API calls. No more complex infrastructure or intricate messaging queues just to initiate a task!
While you can interact with trigger.do via basic API calls, the .do SDK provides a streamlined and developer-friendly experience. It handles authentication, request formatting, and provides a clear interface for triggering your defined workflows and actions.
Here are some key benefits:
Let's dive into a practical example using the .do SDK (specifically the Node.js/TypeScript version, as shown in the provided example, but the principles apply to other SDKs).
First, ensure you have the @do/sdk installed in your project:
npm install @do/sdk
Now, you can use the following code to trigger a workflow:
import { Do } from "@do/sdk";
const doClient = new Do({
apiKey: "YOUR_API_KEY" // Replace with your actual API key from the .do platform
});
async function triggerWorkflow() {
try {
// Replace 'your-workflow-id' with the unique ID of your workflow or action
const result = await doClient.trigger(
"your-workflow-id",
{
payload: {
// You can pass any custom data here to provide context
"user_id": "abc123",
"event_type": "user_registered"
}
}
);
console.log("Trigger successful:", result);
} catch (error) {
console.error("Failed to trigger workflow:", error);
}
}
triggerWorkflow();
In this code:
Let's address some common questions about trigger.do and triggering with the .do SDK:
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. This is done via the payload field in the trigger() method's options.
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. Each configurable process in your .do environment will have a distinct ID you can use with trigger.do.
By integrating trigger.do with the .do SDK, you unlock a powerful way to connect your applications and services to the robust automation capabilities of the .do platform. Whether you're building innovative AI agents or streamlining your business processes, the ability to reliably and programmatically initiate actions is essential.
Ready to get started? Head over to the .do platform, define your workflows or actions, grab their IDs, and begin triggering them directly from your code.
<a href="#" class="badge">Start Anything Now</a>