In Enterprise WeChat, departments aren't just org chart decorations — they're the natural boundaries for data access, skill availability, and bot behavior. If your OpenClaw bot treats the finance department the same as the marketing department, you're one misconfigured prompt away from a data leak.
Department-level permissions ensure that each team gets exactly the capabilities they need — and nothing they shouldn't have.
Consider what happens without them:
Department permissions prevent all of these scenarios by mapping Enterprise WeChat department IDs to specific bot behaviors.
# /opt/clawdbot/config/wecom-dept-permissions.yaml
channel: wecom
wecom:
corp_id: "${WECOM_CORP_ID}"
agent_id: "${WECOM_AGENT_ID}"
secret: "${WECOM_SECRET}"
department_permissions:
finance:
dept_ids: [100, 101] # Finance & Accounting
skills:
- financial-report
- budget-query
- expense-approval
model: "claude-sonnet-4-20250514"
system_prompt: "You are a financial assistant. Only discuss financial data with authorized personnel."
data_access:
- financial_reports
- budget_data
max_tokens: 2000
engineering:
dept_ids: [200, 201, 202] # Engineering teams
skills:
- code-review
- ci-status
- jira-lookup
- deployment-status
model: "claude-sonnet-4-20250514"
system_prompt: "You are an engineering assistant. Help with code, CI/CD, and technical questions."
data_access:
- codebase
- ci_logs
max_tokens: 3000
marketing:
dept_ids: [300]
skills:
- content-generator
- analytics-query
- social-media-scheduler
model: "claude-sonnet-4-20250514"
system_prompt: "You are a marketing assistant. Help with content creation and campaign analytics."
data_access:
- marketing_analytics
- campaign_data
max_tokens: 2000
default:
skills:
- general-qa
- company-directory
model: "claude-haiku"
system_prompt: "You are a general company assistant. Answer common questions only."
data_access: []
max_tokens: 500
Get your instance running:
Upload and activate:
scp wecom-dept-permissions.yaml root@YOUR_LIGHTHOUSE_IP:/opt/clawdbot/config/
ssh root@YOUR_LIGHTHOUSE_IP << 'EOF'
clawdbot validate --config /opt/clawdbot/config/wecom-dept-permissions.yaml
sudo systemctl restart clawdbot
echo "Department permissions active"
EOF
When a message arrives from Enterprise WeChat, OpenClaw:
user_id from the webhook payloaddepartment_id# Verify department resolution is working
journalctl -u clawdbot -f --no-pager | grep "dept_resolved"
# Expected: dept_resolved user=wxuser_123 dept=200 profile=engineering
What happens when someone from marketing asks an engineering question? The bot should handle it gracefully:
cross_department:
policy: "inform_and_redirect"
message: |
This question falls outside my capabilities for your department.
I can help with: {available_skills}
For engineering questions, please contact the engineering team directly.
This prevents data leakage while keeping the user experience friendly.
Track who's accessing what:
#!/bin/bash
# /opt/clawdbot/dept-audit.sh
echo "=== Department Access Audit ==="
echo "Date: $(date)"
echo ""
for dept in finance engineering marketing; do
echo "[$dept]"
echo " Requests: $(grep "profile=$dept" /var/log/clawdbot/output.log | wc -l)"
echo " Denials: $(grep "profile=$dept.*DENIED" /var/log/clawdbot/output.log | wc -l)"
echo " Unique users: $(grep "profile=$dept" /var/log/clawdbot/output.log | grep -oP 'user=\K[^ ]+' | sort -u | wc -l)"
echo ""
done
echo "[default/unmatched]"
echo " Requests: $(grep "profile=default" /var/log/clawdbot/output.log | wc -l)"
People move between departments. When they do, their permissions should follow automatically — because permissions are tied to department IDs, not user IDs. The next time the user sends a message, OpenClaw re-resolves their department and applies the new profile.
No manual permission updates needed. No stale access lists.
Need to cut off a department's access immediately?
# Quick lockdown: add the department to a blocklist
ssh root@YOUR_LIGHTHOUSE_IP << 'EOF'
# Add blocked department
cat >> /opt/clawdbot/config/wecom-dept-permissions.yaml << 'YAML'
blocked_departments:
- 999 # Compromised department
YAML
sudo systemctl restart clawdbot
EOF
default profile for known teamsDepartment permissions are the enterprise-grade access control your bot needs. They're not complex to set up, but they make a massive difference in security and user experience.
Right access. Right people. Right department.