Daptin provides a comprehensive workflow and automation system with actions, state machines, scheduled tasks, integrations, and data exchange capabilities.
Actions are the core automation primitives in Daptin. They allow you to trigger business logic, integrate with external services, and automate workflows.
- List Guest Actions:
GET /actions- Returns signup/signin actions available without auth - Execute Action:
POST /action/{entity}/{actionName}- Execute an action on an entity - Get Action Info:
GET /action/{entity}/{actionName}- Get action details
user_account/signin- Authenticate user and get JWT tokenuser_account/signup- Register new useruser_account/become_admin- Become system administrator (one-time)user_account/generate_jwt_token- Generate new JWT tokenuser_account/otp_generate- Generate OTP for 2FAuser_account/otp_login_verify- Verify OTP loginuser_account/generate_password_reset_flow- Start password resetuser_account/generate_password_reset_verify_flow- Complete password resetuser_account/switch_session_user- Switch user context
{entity}/export_data- Export entity data as JSON{entity}/export_csv_data- Export entity data as CSV{entity}/import_data- Import data into entity{entity}/csv_to_entity- Import CSV data{entity}/xls_to_entity- Import Excel data{entity}/generate_random_data- Generate test data
mail/send- Send email via SMTPmail/send_ses- Send email via AWS SESmail_servers_sync- Sync mail server configurations
cloudstore_file_upload- Upload file to cloud storagecloudstore_file_delete- Delete file from cloud storagecloudstore_folder_create- Create folder in cloud storagecloudstore_path_move- Move/rename pathscloudstore_site_create- Create new sitesite_sync_storage- Sync site with storagecolumn_sync_storage- Sync column data with storageimport_cloudstore_files- Import files from cloud storage
world/restart_system- Restart Daptin serverworld/enable_graphql- Enable GraphQL endpointworld/download_cms_config- Download CMS configurationworld/delete_table- Delete entity tableworld/delete_column- Delete entity columnworld/rename_column- Rename entity column
integration_execute- Execute integrationintegration_install- Install integrationoauth_login_begin- Start OAuth flowoauth_login_response- Handle OAuth callbackoauth_profile_exchange- Exchange OAuth profilegenerate_oauth2_token- Generate OAuth2 token
network_request- Make HTTP requestsexecute_process- Run system processesrender_template- Render templatesmake_response- Create custom responsestransaction- Execute database transactionsgenerate_random_data- Generate random valuesrandom_value_generate- Generate specific random valuesgenerate_self_tls_certificate- Generate self-signed TLS certgenerate_acme_tls_certificate- Generate Let's Encrypt cert
{
"attributes": {
"field1": "value1",
"field2": "value2"
}
}Actions return an array of response directives:
[
{
"ResponseType": "client.notify",
"Attributes": {
"message": "Action completed successfully",
"title": "Success",
"type": "success"
}
},
{
"ResponseType": "client.redirect",
"Attributes": {
"location": "/dashboard",
"window": "self",
"delay": 2000
}
},
{
"ResponseType": "client.file.download",
"Attributes": {
"content": "base64-encoded-content",
"contentType": "application/json",
"name": "export.json"
}
}
]client.notify- Show notification to userclient.redirect- Redirect browserclient.file.download- Download fileclient.store.set- Store value in clientclient.cookie.set- Set cookiejwt.token- Return JWT tokenRestart- Restart system
Custom actions can be defined in the world schema with:
- Input fields specification
- Output/response actions
- Validations
- Conformations (data transformations)
- Permissions
Example action definition:
{
"Name": "send_notification",
"Label": "Send Notification",
"OnType": "notification",
"InstanceOptional": false,
"InFields": [
{
"Name": "recipient",
"ColumnType": "email",
"IsNullable": false
},
{
"Name": "message",
"ColumnType": "content",
"IsNullable": false
}
],
"OutFields": [
{
"Type": "notification",
"Method": "POST",
"Attributes": {
"recipient": "~recipient",
"message": "~message",
"sent_at": "~now"
}
},
{
"Type": "client.notify",
"Method": "ACTIONRESPONSE",
"Attributes": {
"message": "Notification sent successfully",
"type": "success"
}
}
],
"Validations": [
{
"ColumnName": "recipient",
"Tags": "email,required"
}
]
}Daptin includes a finite state machine (FSM) system for modeling workflows and business processes.
smd- State Machine Definitionssmd_state- Individual states within machines{entity}_state- State tracking for entities{entity}_state_audit- State transition audit logs
- Define states and transitions
- Event-driven state changes
- Permission-based transitions
- Automatic audit logging
- State-based validations
- Before/after transition hooks
POST /api/event/{entity}/{objectStateId}/{eventName}
Triggers state transitions on objects.
The task table enables scheduled job execution.
name- Task identifierschedule- Cron expressionaction_name- Action to executeentity_name- Target entityattributes- JSON attributes for actionactive- Enable/disable flaglast_run- Last execution timestampnext_run- Next scheduled execution
Standard cron format:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6)
# │ │ │ │ │
# * * * * *
Examples:
0 0 * * *- Daily at midnight*/15 * * * *- Every 15 minutes0 9 * * 1- Every Monday at 9 AM
oauth_connect- OAuth provider configurationsoauth_token- Stored OAuth tokensintegration- Third-party integrations
Configure OAuth providers for:
- GitHub
- Custom OAuth2 providers
- OAuth 2.0 flow handling
- Token refresh automation
- Profile data mapping
- Webhook receivers
- API gateway functionality
The data_exchange table enables data synchronization and ETL operations.
-
REST API Exchange
- Import/export via REST APIs
- Scheduled sync
- Field mapping
- Data transformation
-
File-based Exchange
- CSV/JSON/XML import/export
- Cloud storage integration
- Scheduled transfers
-
Database Exchange
- Direct database connections
- Cross-database sync
- Schema mapping
{
"source": {
"type": "rest",
"endpoint": "https://api.example.com/data",
"auth": {
"type": "bearer",
"token": "{{oauth_token}}"
}
},
"destination": {
"type": "entity",
"name": "products"
},
"mapping": {
"id": "external_id",
"title": "name",
"price": "cost"
},
"schedule": "0 */6 * * *"
}// 1. User signs up
POST /action/user_account/signup
// 2. Generate OTP if mobile provided
POST /action/user_account/otp_generate
// 3. Send welcome email
POST /action/mail/send
// 4. Create initial user data
POST /api/user_profile// 1. Upload CSV file
POST /action/file/cloudstore_file_upload
// 2. Import CSV data
POST /action/products/csv_to_entity
// 3. Validate imported data
POST /action/products/validate_data
// 4. Send notification
POST /action/mail/send// Task configuration
{
"name": "daily_report",
"schedule": "0 8 * * *",
"action_name": "generate_report",
"entity_name": "report",
"attributes": {
"format": "pdf",
"recipients": ["admin@example.com"]
}
}// 1. Start OAuth flow
POST /action/oauth/oauth_login_begin
{
"attributes": {
"provider": "google"
}
}
// 2. Handle callback (automatic)
// 3. Exchange profile data
POST /action/oauth/oauth_profile_exchange
// 4. Use OAuth token for API calls
POST /action/integration/integration_execute
{
"attributes": {
"integration_name": "google_calendar"
}
}- Keep actions focused and single-purpose
- Use appropriate response types
- Implement proper error handling
- Add validation for inputs
- Log important operations
- Define clear state transitions
- Use meaningful state names
- Implement transition guards
- Add audit logging
- Handle edge cases
- Use appropriate cron expressions
- Monitor task execution
- Handle failures gracefully
- Avoid overlapping executions
- Log task outcomes
- Store credentials securely
- Use OAuth when possible
- Implement rate limiting
- Validate webhook signatures
- Monitor API usage
Actions can trigger other actions through their OutFields:
{
"OutFields": [
{
"Type": "mail.send",
"Method": "EXECUTE",
"Condition": "email != null",
"Attributes": {
"to": ["~email"],
"subject": "Action completed"
}
},
{
"Type": "task",
"Method": "POST",
"Attributes": {
"name": "followup_task",
"schedule": "0 0 * * *",
"action_name": "check_status"
}
}
]
}Use conditions in action definitions:
{
"Condition": "status == 'active' && credit > 0",
"ContinueOnError": true
}Group multiple operations in transactions:
POST /action/world/transaction
{
"attributes": {
"operations": [
{
"type": "create",
"entity": "order",
"data": {...}
},
{
"type": "update",
"entity": "inventory",
"id": "123",
"data": {...}
}
]
}
}Daptin's workflow system provides:
- 50+ built-in actions for common tasks
- Custom action creation
- State machine workflows
- Scheduled task execution
- OAuth integrations
- Data exchange/ETL
- Transaction support
- Comprehensive audit logging
This makes Daptin suitable for building complex business applications with sophisticated automation requirements.