User onboarding is the first handshake between your product and a new customer. A smooth experience can lead to long-term loyalty, but a buggy, unreliable process can sour the relationship before it even begins. The classic onboarding script—a long function that creates a user, sends an email, assigns permissions, and more—is a time bomb waiting to go off. What happens when your email service has a momentary outage after the user record has already been created? You're left with a system in an inconsistent state and a user left in the dark.
There's a better way. By breaking down complex processes into discrete, indivisible steps, you can build workflows that are robust, auditable, and failure-resistant. This is the power of atomic actions, and action.do is the tool designed to make them the cornerstone of your automation.
Let's consider a typical onboarding process. It might look something like this in a single script:
This monolithic approach is fraught with peril:
action.do introduces a new paradigm: treat every single task as a manageable, observable service. Instead of one giant script, you define a series of self-contained, atomic actions.
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state. It’s a guarantee. This approach transforms your fragile script into a robust, observable workflow.
Let's redesign our user onboarding process using atomic actions defined in action.do:
Now, an orchestration agent (like workflow.do or your own custom code) simply calls these actions in sequence. The logic becomes clear and declarative.
Executing a single, predefined action is incredibly simple. Here’s how you would call the send-welcome-email action:
import { DotDo } from '@do-platform/sdk';
const client = new DotDo({ apiKey: 'YOUR_API_KEY' });
// Execute a predefined action, 'send-welcome-email'
async function sendWelcomeEmail(userId: string) {
const result = await client.action('send-welcome-email').execute({
userId: userId,
template: 'new-user-template-2024',
});
console.log(`Action completed with status: ${result.status}`);
return result;
}
The orchestrator's job is now drastically simplified. It calls create-user-record, and on success, uses the outputted userId to call send-welcome-email, and so on. If any action fails, the workflow can be paused, an alert can be triggered, and you have a perfect audit trail showing exactly which step failed and why, without leaving your system in a messy, inconsistent state.
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state. This guarantees data integrity and reliability in your workflows.
action.do provides a layer of abstraction with built-in observability, retries, and audit trails. It treats actions as manageable, versioned services, making your automation more robust and transparent than a standard function.
You can define any action that can be scripted, such as making an API call, sending an email, updating a database record, interacting with a smart contract, or running a shell command.
Yes. action.do is designed as a fundamental building block. You can use an orchestration agent (like workflow.do) to chain multiple atomic actions together to create complex and powerful services.
By shifting from monolithic scripts to a composition of atomic actions, you're not just writing code; you're engineering a resilient, scalable, and transparent system. The user onboarding process is no longer a fragile liability but a bulletproof asset.
action.do provides the fundamental building block for this modern approach to automation. Define, execute, and audit any single task within your business workflows and build services you can trust.
Ready to make your workflows bulletproof? Explore action.do and start building with confidence.