Integrate and Extend with the .do SDK Unlock powerful platform capabilities and build custom integrations with our comprehensive Software Development Kit. Bring Business-as-Code to your applications.
Join waitlist
import { DoClient } from '@do/sdk';
// Initialize the client
const doClient = new DoClient({
apiKey: process.env.DO_API_KEY, // Use environment variables for security
});
// Example: Trigger a specific workflow
async function triggerMyWorkflow(workflowId: string, inputData: any) {
try {
console.log(`Triggering workflow: ${workflowId}`);
const execution = await doClient.workflows.run({
workflowId: workflowId,
input: inputData,
// Optional: Wait for completion
// wait: true,
});
console.log('Workflow triggered successfully:', execution);
return execution;
} catch (error) {
console.error('Failed to trigger workflow:', error);
throw error;
}
}
// Example usage
triggerMyWorkflow('wf_onboarding_123', { userId: 'usr_abc789', plan: 'premium' });