Last Modified : 08 August 2026
Custom Action
The Custom Action executes an arbitrary shell command or script when an event is detected. The event data is passed as a Base64-encoded UTF-8 argument, allowing you to accomplish custom and complex actions in your own.
Configuration
| Option | Type | Description |
|---|---|---|
| ID | String | A unique identifier for this action. Can be alphanumeric. |
| Command | String |
The shell command or script to execute. The event data is
passed as a Base64-encoded in stdin buffer. The
working directory is the Scripts Directory set
in app settings.
|
| Timeout (ms) | Integer | Maximum execution time in milliseconds. |
| Enabled | Boolean | Whether this action is active. Disabled actions are skipped when events occur. |
Example
A custom action that logs received data to a file
action_log.txt in the scripts directory:
#!/usr/bin/env python3
"""
log_test.py - A custom action that logs received data to a file.
This script receives event data via stdin and appends it to a log file.
"""
import sys
import json
import base64
from datetime import datetime
import os
def main():
# Read data from stdin (should be the event data from the trigger)
input_data = sys.stdin.read().strip()
# Try to decode if it's base64 (as sent by our trigger)
try:
# Try to parse as JSON first
json_data = json.loads(input_data)
if "data" in json_data:
# Extract and decode the data field
encoded_data = json_data["data"]
decoded_data = base64.b64decode(encoded_data).decode('utf-8')
else:
decoded_data = input_data
except (json.JSONDecodeError, UnicodeDecodeError):
# If not JSON or base64, use raw input
decoded_data = input_data
# Get the scripts directory (working directory set by the application)
script_dir = os.getcwd()
log_file = os.path.join(script_dir, "action_log.txt")
# Create log entry
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
log_entry = f"[{timestamp}] Action executed. Received data: {decoded_data}\n"
# Append to log file
try:
with open(log_file, "a") as f:
f.write(log_entry)
print(f"Successfully logged to {log_file}", file=sys.stderr)
except Exception as e:
print(f"Error writing to log file: {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()