xiaoxiaxia-temp / scripts /feishu-setup.sh
sharween's picture
Upload scripts/feishu-setup.sh with huggingface_hub
c6953c2 verified
Raw
History Blame Contribute Delete
2.07 kB
#!/bin/bash
# scripts/feishu-setup.sh — 飞书 6 机器人通道配置 + Agent 绑定
# 正确格式:channels.feishu.accounts.{bot-name}.{appId, appSecret, domain}
# 使用 openclaw channels add + openclaw config set 命令
set -e
STATE_DIR="${OPENCLAW_STATE_DIR:-/root/.openclaw}"
echo "Configuring Feishu channels (6 bots -> 6 agents)..."
# 启用飞书插件
openclaw plugins enable feishu 2>/dev/null || true
for i in 1 2 3 4 5 6; do
app_id_var="FEISHU${i}_APPID"
app_sec_var="FEISHU${i}_SECRET"
enabled_var="FEISHU${i}_ENABLED"
app_id="${!app_id_var}"
app_sec="${!app_sec_var}"
enabled="${!enabled_var:-true}"
if [[ -n "$app_id" && -n "$app_sec" && "$enabled" == "true" ]]; then
bot_name="feishu-agent-${i}"
agent_id="agent-${i}"
echo " -> Bot ${i} (${bot_name}) -> ${agent_id}..."
# Method 1: openclaw channels add (preferred)
openclaw channels add \
--channel feishu \
--account "$bot_name" \
--token "${app_id}:${app_sec}" 2>/dev/null || {
# Method 2: Fallback with individual config set
openclaw config set "channels.feishu.accounts.${bot_name}.appId" "$app_id" 2>/dev/null || true
openclaw config set "channels.feishu.accounts.${bot_name}.appSecret" "$app_sec" 2>/dev/null || true
openclaw config set "channels.feishu.accounts.${bot_name}.domain" "feishu" 2>/dev/null || true
openclaw config set "channels.feishu.accounts.${bot_name}.enabled" true 2>/dev/null || true
openclaw config set "channels.feishu.accounts.${bot_name}.connectionMode" "websocket" 2>/dev/null || true
openclaw config set "channels.feishu.accounts.${bot_name}.streaming" true 2>/dev/null || true
}
# Ensure feishu channel is enabled
openclaw config set "channels.feishu.enabled" true 2>/dev/null || true
echo " Bot ${i} configured"
else
echo " -> Bot ${i}: skipped (no credentials or disabled)"
fi
done
echo "Feishu channels configured"