Create custom actions to extend DrDroid’s capabilities with your own scripts and API integrations.

Supported Custom Actions

  • REST API Calls
  • Webhooks
  • Custom Scripts (Bash, Python, etc.)
  • AWS CLI Commands
  • Kubernetes Operations

Action Types

1. HTTP Requests

method: POST
url: https://api.example.com/endpoint
headers:
  Content-Type: application/json
  Authorization: Bearer ${API_KEY}
body: |
  {
    "key": "value",
    "timestamp": "${CURRENT_TIMESTAMP}"
  }

2. Shell Scripts

#!/bin/bash
# Get current CPU load
LOAD=$(uptime | awk -F'[a-z]:' '{ print $2 }')

# Send to monitoring system
curl -X POST https://monitor.example.com/api/events \
  -H "Authorization: Bearer ${API_KEY}" \
  -d "{\"load\": \"$LOAD\"}"

Examples

Kubernetes Pod Restart

action: kubernetes
execute: delete-pod
namespace: ${NAMESPACE}
pod: ${POD_NAME}

AWS S3 File Check

action: aws
service: s3
command: ls s3://${BUCKET_NAME}/

Best Practices

  • Use environment variables for sensitive data
  • Implement proper error handling
  • Add timeouts for all external calls
  • Document your custom actions
  • Test thoroughly before production use