What are Actions?
Actions are operations that users can perform in their flows. They take inputs (props), execute logic, and return outputs. Think of them as functions that can be called from automation workflows. Examples:- Send a message to Slack
- Create an issue in GitHub
- Upload a file to Google Drive
- Query a database
Creating Your First Action
Use the CLI to generate an action:- Piece name: Which piece to add the action to
- Action name: Unique identifier (e.g.,
send_message) - Display name: Human-readable name (e.g.,
Send Message) - Description: What the action does
Action Structure
Here’s a real example from the GitHub piece:packages/pieces/community/github/src/lib/actions/create-issue.ts
Action Configuration
string
required
Unique identifier for the action within the piece. Use snake_case.Example:
send_message, create_issue, upload_filestring
required
Human-readable name shown in the UI. Use Title Case.Example:
Send Message, Create Issue, Upload Filestring
required
Brief description of what the action does. Shown as a tooltip.Example:
Send a message to a Slack channelPieceAuth
Authentication configuration. References the piece’s auth.
Record<string, Property>
required
Input properties that users configure. See Properties.
function
required
The main execution function. Receives context with auth and prop values.
function
Optional test function for validating the action works. If not provided,
run is used for testing.boolean
default:"true"
Whether authentication is required. Set to
false for public APIs.Complete Action Examples
- Slack Send Message
- OpenAI Completion
- HTTP Request
Action Context
Thecontext object passed to your run function contains:
Using Context
Error Handling
Provide clear error messages to help users debug issues:Testing Actions
Test your action during development:1
Start Dev Server
2
Create Test Flow
- Go to
http://localhost:4200 - Create a new flow
- Add your action as a step
3
Configure & Test
- Fill in the required properties
- Click “Test” button
- Check the output
4
Iterate
Make changes to your action code - they’ll be reflected immediately thanks to hot reloading
Best Practices
Return Useful Data
Return Useful Data
Return structured data that can be used in subsequent steps:
Validate Inputs
Validate Inputs
Check inputs before making API calls:
Use Descriptive Names
Use Descriptive Names
Make property names clear and self-documenting:
Handle Rate Limits
Handle Rate Limits
Implement retry logic for rate-limited APIs:
Next Steps
Create Triggers
Learn how to create triggers
Properties Guide
Explore all property types
Testing
Write tests for your actions