Loading...
Loading...
Configure OpenClaw gateway integration for waking external automations and AI agents on hook events
npx skill4agent add yeachan-heo/oh-my-claudecode configure-openclaw~/.claude/omc_config.openclaw.jsonCONFIG_FILE="${OMC_OPENCLAW_CONFIG:-$HOME/.claude/omc_config.openclaw.json}"
if [ -f "$CONFIG_FILE" ]; then
IS_ENABLED=$(jq -r '.enabled // false' "$CONFIG_FILE" 2>/dev/null)
GATEWAY_COUNT=$(jq -r '.gateways | keys | length' "$CONFIG_FILE" 2>/dev/null)
HOOK_COUNT=$(jq -r '[.hooks | to_entries[] | select(.value.enabled == true)] | length' "$CONFIG_FILE" 2>/dev/null)
if [ "$IS_ENABLED" = "true" ]; then
echo "EXISTING_CONFIG=true"
echo "GATEWAY_COUNT=$GATEWAY_COUNT"
echo "HOOK_COUNT=$HOOK_COUNT"
else
echo "EXISTING_CONFIG=false"
fi
else
echo "NO_CONFIG_FILE"
fihttps://Bearer sk-...Bearer sk-mytoken123{{sessionId}}{{projectName}}{{projectPath}}{{contextSummary}}{{reason}}{{sessionId}}{{sessionId}}{{projectName}}{{toolName}}{{sessionId}}{{toolName}}{{sessionId}}{{prompt}}{{sessionId}}{{question}}{{sessionId}}session-start{{sessionId}}{{projectName}}{{projectPath}}{{timestamp}}session-end{{sessionId}}{{projectName}}{{contextSummary}}{{reason}}{{timestamp}}stop{{sessionId}}{{projectName}}{{projectPath}}{{timestamp}}pre-tool-use{{toolName}}{{sessionId}}{{projectName}}{{timestamp}}post-tool-use{{toolName}}{{sessionId}}{{projectName}}{{timestamp}}keyword-detector{{prompt}}{{sessionId}}{{projectName}}{{timestamp}}ask-user-question{{question}}{{sessionId}}{{projectName}}{{timestamp}}~/.claude/omc_config.openclaw.jsonCONFIG_FILE="${OMC_OPENCLAW_CONFIG:-$HOME/.claude/omc_config.openclaw.json}"
mkdir -p "$(dirname "$CONFIG_FILE")"
# GATEWAY_URL, AUTH_HEADER, and per-event instructions are collected from user
# SELECTED_EVENTS is the list of enabled hook events
# Build the JSON using jq
# Example: session-start and session-end selected, bearer auth
jq -n \
--arg gateway_url "$GATEWAY_URL" \
--arg auth_header "$AUTH_HEADER" \
--arg session_start_instruction "$SESSION_START_INSTRUCTION" \
--arg session_end_instruction "$SESSION_END_INSTRUCTION" \
--arg stop_instruction "$STOP_INSTRUCTION" \
'{
enabled: true,
gateways: {
"my-gateway": {
url: $gateway_url,
headers: (if $auth_header != "" then {"Authorization": $auth_header} else {} end),
method: "POST",
timeout: 10000
}
},
hooks: {
"session-start": {gateway: "my-gateway", instruction: $session_start_instruction, enabled: true},
"session-end": {gateway: "my-gateway", instruction: $session_end_instruction, enabled: true},
"stop": {gateway: "my-gateway", instruction: $stop_instruction, enabled: true}
}
}' > "$CONFIG_FILE"GATEWAY_URL="USER_PROVIDED_URL"
AUTH_HEADER="USER_PROVIDED_AUTH_HEADER" # may be empty
# Build auth header arg
AUTH_ARG=""
if [ -n "$AUTH_HEADER" ]; then
AUTH_ARG="-H \"Authorization: $AUTH_HEADER\""
fi
RESPONSE=$(eval curl -s -w "\n%{http_code}" \
-H "Content-Type: application/json" \
$AUTH_ARG \
-d '{"event":"session-start","instruction":"OpenClaw test wake from OMC configure wizard","timestamp":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","context":{}}' \
"$GATEWAY_URL")
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | head -1)
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "202" ] || [ "$HTTP_CODE" = "204" ]; then
echo "Test wake succeeded (HTTP $HTTP_CODE)!"
else
echo "Test wake failed (HTTP $HTTP_CODE):"
echo "$BODY"
fiOpenClaw Gateway Configured!
Gateway: https://my-gateway.example.com/wake
Auth: Bearer *** (configured)
Events: session-start, session-end, stop
Config saved to: ~/.claude/omc_config.openclaw.json
To activate OpenClaw, use one of:
omc --openclaw (per-session flag)
export OMC_OPENCLAW=1 (environment variable)
Debug logging:
export OMC_OPENCLAW_DEBUG=1 (logs wake results to stderr)
Custom config path:
export OMC_OPENCLAW_CONFIG=/path/to/config.json
To reconfigure: /oh-my-claudecode:configure-openclaw| Event | Available Variables |
|---|---|
| |
| |
| |
| |
| |
| |
| |
{{unknown}}# Enable OpenClaw
export OMC_OPENCLAW=1
# Optional: override config file path
export OMC_OPENCLAW_CONFIG="$HOME/.claude/omc_config.openclaw.json"
# Optional: enable debug logging
export OMC_OPENCLAW_DEBUG=1~/.claude/omc_config.openclaw.jsonOMC_OPENCLAW_CONFIG