.do
Execution

actions

Perform tasks and operations within workflows

actions

Atomic action primitives for building workflows and automations with reusable, composable operations that can be chained together.

Overview

The actions primitive provides pre-built and custom action definitions that can be used in workflows, triggered by events, or executed independently with parameters and return values.

Parent Primitive: webhooks - Webhook management

SDK Object Mapping

This primitive maps to the api SDK object - one of the 8 core platform objects:

import { api, on, send, actions } from 'sdk.do'

// API - Execute actions (api is one of 8 core SDK objects)
await api.action('slack.send_message', {
  channel: '#general',
  text: 'Deployment complete!',
})

await api.action('github.create_issue', {
  repo: 'acme/project',
  title: 'Bug found',
  body: 'Description...',
})

// Define custom action
const sendNotification = await actions.define({
  name: 'send-notification',
  parameters: {
    userId: { type: 'string', required: true },
    message: { type: 'string', required: true },
  },
  handler: async ({ userId, message }) => {
    const user = await db.get('users', userId)
    await api.action('sendgrid.send_email', {
      to: user.email,
      subject: 'Notification',
      body: message,
    })
    return { sent: true }
  },
})

// Execute via on/send
on('order.created', async ({ order }) => {
  await actions.execute('send-notification', {
    userId: order.userId,
    message: 'Your order has been received!',
  })
})

Quick Example

import { actions } from 'sdk.do'

// Define custom action
const sendNotification = await actions.define({
  name: 'send-notification',
  description: 'Send notification to user',
  parameters: {
    userId: { type: 'string', required: true },
    message: { type: 'string', required: true },
    channel: { type: 'string', enum: ['email', 'sms', 'push'] },
  },
  handler: async ({ userId, message, channel }) => {
    const user = await db.get('users', userId)
    await notify(user, message, channel)
    return { sent: true, timestamp: Date.now() }
  },
})

// Execute action
const result = await actions.execute('send-notification', {
  userId: 'user-123',
  message: 'Your order has shipped!',
  channel: 'email',
})

// Use in workflow
await workflow.create({
  name: 'order-fulfillment',
  steps: [actions.get('validate-order'), actions.get('charge-payment'), actions.get('send-notification')],
})

Core Capabilities

  • Action Library - Pre-built actions for common operations
  • Custom Actions - Define reusable business logic
  • Parameter Validation - Type-safe input validation
  • Composable - Chain actions together in workflows
  • Error Handling - Built-in retry and error handling

Access Methods

SDK

TypeScript/JavaScript library for action management

await actions.execute('send-notification', { userId: 'user-123', message: 'Hello!' })

SDK Documentation

CLI

Command-line tool for action execution

do action execute send-notification --userId user-123 --message "Hello!"

CLI Documentation

API

REST/RPC endpoints for action operations

curl -X POST https://api.do/v1/actions/send-notification/execute -d '{"userId":"user-123"}'

API Documentation

MCP

Model Context Protocol for AI-driven action execution

Execute the send-notification action for user-123 with message "Hello!"

MCP Documentation

Parent Primitive

Sibling Primitives

  • api - API integrations (SDK object mapping)
  • workflows - Multi-step processes
  • functions - Function execution
  • on - Event handlers