Install
openclaw skills install self-promptForce agents to respond to automated messages by using `openclaw agent` instead of `openclaw message send`, ensuring tasks from scripts get agent replies.
openclaw skills install self-promptWhen automated scripts (cron, monitoring) send messages via openclaw message send:
Use openclaw agent instead of openclaw message send for messages requiring agent response:
# OLD (agent may ignore):
openclaw message send --target -GROUP_ID --message "TASK: Do something"
# NEW (agent MUST respond):
RESPONSE=$(openclaw agent \
--agent AGENT_ID \
--session-id "agent:AGENT_ID:telegram:group:GROUP_ID" \
--channel telegram \
--message "TASK: Do something" \
--timeout 180)
# Send response to chat:
openclaw message send --target -GROUP_ID --message "$RESPONSE"
openclaw message send → Creates chat message → Agent sees as "notification"openclaw agent → Triggers actual agent turn → Agent MUST process and respondUse scripts/send_agent_task.sh:
# Simple usage:
~/.openclaw/skills/self-prompt/scripts/send_agent_task.sh \
"AGENT_ID" \
"GROUP_ID" \
"Your task message here"
Use scripts/send_agent_task.py:
from send_agent_task import send_and_deliver
success, response = send_and_deliver(
agent_id="stock-trading",
group_id="-5283045656",
message="TASK: Analyze current positions",
timeout=180
)
For monitoring scripts, separate data delivery from task requests:
# 1. Send DATA immediately (informational)
openclaw message send --target "$GROUP_ID" --message "📊 Position Data:
$POSITIONS"
# 2. Send TASK via agent (forces response)
RESPONSE=$(openclaw agent \
--agent "$AGENT_ID" \
--session-id "agent:$AGENT_ID:telegram:group:$GROUP_ID" \
--message "Analyze the data above and report findings" \
--timeout 180)
# 3. Deliver response
openclaw message send --target "$GROUP_ID" --message "📊 Analysis:
$RESPONSE"
# Force agent to respond to accountability check
send_agent_task.sh "my-agent" "-123456789" \
"ACCOUNTABILITY CHECK: Did you complete the required tasks? Respond with status."
# Force agent to investigate and report
send_agent_task.sh "trading-agent" "-123456789" \
"ALERT: Position down 5%. Investigate and report findings."
# Force agent to do research
send_agent_task.sh "research-agent" "-123456789" \
"DAILY TASK: Search for news on $SYMBOLS and summarize findings."
The session key follows this pattern:
agent:AGENT_ID:CHANNEL:TYPE:TARGET
Examples:
agent:stock-trading:telegram:group:-5283045656agent:main:telegram:direct:123456789agent:assistant:discord:channel:987654321Location: scripts/send_agent_task.sh
send_agent_task.sh AGENT_ID GROUP_ID "message" [timeout]
openclaw agentmessage send~/agent_task.logLocation: scripts/send_agent_task.py
from send_agent_task import send_and_deliver
success, response = send_and_deliver(
agent_id="agent-name",
group_id="-123456789",
message="Task message",
timeout=180,
channel="telegram"
)
openclaw gateway statusmessage send after capturing