深夜提醒

现在是深夜,建议您注意休息,不要熬夜哦~

🏮 🏮 🏮

新年快乐

祝君万事如意心想事成!

share-image
中
ESC

Deploying OpenClaw + Feishu Bot: From Pitfalls to Success

English 阅读中文版

This article documents my complete process of deploying the OpenClaw personal AI assistant and connecting it to a Feishu bot, including all the pitfalls I ran into and how I solved them.

Project Introduction

OpenClaw is a personal AI assistant that runs locally and can connect to various messaging platforms (Telegram, Discord, Feishu, etc.). Unlike other AI tools, OpenClaw is an execution engine that goes “from giving advice to doing things.” It can:

  • Read local files and execute commands
  • Connect to IM platforms like Feishu and Telegram
  • Integrate multiple AI models (OpenAI, Kimi, Claude, etc.)
  • Receive messages through a long connection or Webhook

Environment Preparation

System Requirements

  • Ubuntu 22.04+ / macOS / Windows
  • Node.js 22 or newer
  • A Feishu developer account

Installing OpenClaw

# Global install
npm install -g openclaw

# Verify the installation
openclaw --version

Deployment Process

1. Initial Configuration

Quick deployment using non-interactive mode:

openclaw onboard \
--non-interactive \
--accept-risk \
--flow quickstart \
--auth-choice synthetic-api-key \
--synthetic-api-key "sk-synthetic-$(date +%s)" \
--install-daemon

After a successful deployment, the Gateway service runs in the background:

2. Configuring the Feishu Bot

After creating an app in the Feishu developer console (https://open.feishu.cn/app/), configure the following:

# Set the Feishu AppID and AppSecret
openclaw config set channels.feishu.appId "cli_xxxxxxxxxxxx"
openclaw config set channels.feishu.appSecret "xxxxxxxxxxxx"
openclaw config set channels.feishu.enabled true

# Restart the service
systemctl --user restart openclaw-gateway

3. Configuring the Kimi AI Model

By default OpenClaw uses a synthetic model (a simulated environment). To connect the real Kimi API:

# Create a systemd environment variable config
mkdir -p ~/.config/systemd/user/openclaw-gateway.service.d/

cat > ~/.config/systemd/user/openclaw-gateway.service.d/env.conf << 'EOF'
[Service]
Environment="MOONSHOT_API_KEY=sk-yourMoonshotAPIKey"
EOF

# Reload and restart
systemctl --user daemon-reload
systemctl --user restart openclaw-gateway

Pitfall Log

Pitfall 1: 401 Invalid Authentication

Problem: Still getting a 401 error after configuring the API Key.

Cause: The API Key was configured under models.providers.moonshot.apiKey, but OpenClaw actually reads authentication info from auth.profiles.

Solution: Configure it via the MOONSHOT_API_KEY environment variable to avoid config file format issues.

Pitfall 2: Kimi Code vs. Moonshot AI

Problem: The API Key requested from the Kimi Code console (www.kimi.com/code) doesn’t work.

Cause: These are two different services:

  • Kimi Code: a membership service aimed at coding scenarios
  • Moonshot AI (platform.moonshot.cn): the developer API platform

Solution: You must request the API Key at https://platform.moonshot.cn/.

Pitfall 3: Wrong Model ID

Problem: A “model does not exist” error:

Not found the model kimi-k2-5 or Permission denied

Cause: The model ID configured in OpenClaw didn’t match the actual one.

Solution: The list of models supported by the Moonshot API:

  • kimi-k2.5 (note the dot — not kimi-k2-5)
  • kimi-k2-turbo-preview
  • moonshot-v1-8k
  • moonshot-v1-32k
  • etc.

Pitfall 4: Insufficient Feishu Permissions

Problem: Messages are received, but the sender’s info can’t be fetched.

Error code: 99991672

Solution: Enable the following permissions in the Feishu developer console:

  • contact:contact.base:readonly
  • im:message:send_as_bot
  • im:chat:readonly
  • im:message.group_msg

Pitfall 5: No Reply to Messages

Problem: You send a message in Feishu, but the bot doesn’t reply.

Cause: ackReactionScope was set to group-mentions, so it only replies when @-mentioned.

Solution:

openclaw config set messages.ackReactionScope all
systemctl --user restart openclaw-gateway

Verifying the Deployment

Check the service status

openclaw status

Key things to check:

  • Gateway: reachable
  • Feishu: ON / OK
  • Sessions: shows active sessions

View real-time logs

openclaw logs --follow

Test API connectivity

curl -X POST https://api.moonshot.cn/v1/chat/completions \
-H "Authorization: Bearer $MOONSHOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k2.5",
"messages": [{"role": "user", "content": "Hello"}]
}'

Final Configuration Reference

Directory Structure

~/.openclaw/
├── openclaw.json # Main config file
├── workspace/ # Working directory
├── agents/
│ └── main/
│ └── sessions/ # Session storage
└── logs/ # Log files

Key Config Entries

~/.openclaw/openclaw.json (partial):

{
"models": {
"mode": "merge",
"providers": {
"moonshot": {
"baseUrl": "https://api.moonshot.cn/v1",
"api": "openai-completions",
"models": [{
"id": "kimi-k2.5",
"name": "Kimi K2.5",
"contextWindow": 256000,
"maxTokens": 8192
}]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "moonshot/kimi-k2.5"
}
}
},
"channels": {
"feishu": {
"appId": "cli_xxxxxxxx",
"appSecret": "xxxxxxxx",
"enabled": true
}
},
"messages": {
"ackReactionScope": "all"
}
}

Common Commands

# Check status
openclaw status
openclaw status --deep

# View logs
openclaw logs --follow

# Restart the service
systemctl --user restart openclaw-gateway

# Security config check
openclaw security audit

# View Feishu channel logs
openclaw channels logs --channel feishu

Summary

With this pitfall log, I hope you can finish deploying OpenClaw + Feishu within 10 minutes, instead of messing around for hours like I did 😅

Key points:

  1. Use an API Key from the Moonshot AI platform (not Kimi Code)
  2. Configuring the API Key via an environment variable is the most stable approach
  3. Remember the model ID is kimi-k2.5 (with a dot)
  4. The Feishu console needs the contacts and messaging permissions enabled

Now your Feishu bot can intelligently reply to messages! 🎉


Reference links:

文章作者:阿文
文章链接: https://www.awen.me/post/6d5cd126.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 阿文的博客!
本文于 2026-03-02 10:17 发布,已超过半年(228天),请注意甄别内容是否已过期。

评论

0 条评论
😀😃😄 😁😅😂 🤣😊😇 🙂🙃😉 😌😍🥰 😘😗😙 😚😋😛 😝😜🤪 🤨🧐🤓 😎🥸🤩 🥳😏😒 😞😔😟 😕🙁☹️ 😣😖😫 😩🥺😢 😭😤😠 😡🤬🤯 😳🥵🥶 😱😨😰 😥😓🤗 🤔🤭🤫 🤥😶😐 😑😬🙄 😯😦😧 😮😲🥱 😴🤤😪 😵🤐🥴 🤢🤮🤧 😷🤒🤕 🤑🤠😈 👿👹👺 🤡💩👻 💀☠️👽 👾🤖🎃 😺😸😹 😻😼😽 🙀😿😾 👍👎👏 🙌👐🤲 🤝🤜🤛 ✌️🤞🤟 🤘👌🤏 👈👉👆 👇☝️✋ 🤚🖐️🖖 👋🤙💪 🦾🖕✍️ 🙏💅🤳 💯💢💥 💫💦💨 🕳️💣💬 👁️‍🗨️🗨️🗯️ 💭💤❤️ 🧡💛💚 💙💜🖤 🤍🤎💔 ❣️💕💞 💓💗💖 💘💝💟 ☮️✝️☪️ 🕉️☸️✡️ 🔯🕎☯️ ☦️🛐⛎ ♈♉♊ ♋♌♍ ♎♏♐ ♑♒♓ 🆔⚛️🉑 ☢️☣️📴 📳🈶🈚 🈸🈺🈷️ ✴️🆚💮 🉐㊙️㊗️ 🈴🈵🈹 🈲🅰️🅱️ 🆎🆑🅾️ 🆘❌⭕ 🛑⛔📛 🚫💯💢 ♨️🚷🚯 🚳🚱🔞 📵🚭❗ ❕❓❔ ‼️⁉️🔅 🔆〽️⚠️ 🚸🔱⚜️ 🔰♻️✅ 🈯💹❇️ ✳️❎🌐 💠Ⓜ️🌀 💤🏧🚾 ♿🅿️🈳 🈂🛂🛃 🛄🛅🛗 🚀🛸🚁 🚉🚆🚅 ✈️🛫🛬 🛩️💺🛰️
加载中...

留言反馈

😀😃😄 😁😅😂 🤣😊😇 🙂🙃😉 😌😍🥰 😘😗😙 😚😋😛 😝😜🤪 🤨🧐🤓 😎🥸🤩 🥳😏😒 😞😔😟 😕🙁☹️ 😣😖😫 😩🥺😢 😭😤😠 😡🤬🤯 😳🥵🥶 😱😨😰 😥😓🤗 🤔🤭🤫 🤥😶😐 😑😬🙄 😯😦😧 😮😲🥱 😴🤤😪 😵🤐🥴 🤢🤮🤧 😷🤒🤕 🤑🤠😈 👿👹👺 🤡💩👻 💀☠️👽 👾🤖🎃 😺😸😹 😻😼😽 🙀😿😾 👍👎👏 🙌👐🤲 🤝🤜🤛 ✌️🤞🤟 🤘👌🤏 👈👉👆 👇☝️✋ 🤚🖐️🖖 👋🤙💪 🦾🖕✍️ 🙏💅🤳 💯💢💥 💫💦💨 🕳️💣💬 👁️‍🗨️🗨️🗯️ 💭💤❤️ 🧡💛💚 💙💜🖤 🤍🤎💔 ❣️💕💞 💓💗💖 💘💝💟 ☮️✝️☪️ 🕉️☸️✡️ 🔯🕎☯️ ☦️🛐⛎ ♈♉♊ ♋♌♍ ♎♏♐ ♑♒♓ 🆔⚛️🉑 ☢️☣️📴 📳🈶🈚 🈸🈺🈷️ ✴️🆚💮 🉐㊙️㊗️ 🈴🈵🈹 🈲🅰️🅱️ 🆎🆑🅾️ 🆘❌⭕ 🛑⛔📛 🚫💯💢 ♨️🚷🚯 🚳🚱🔞 📵🚭❗ ❕❓❔ ‼️⁉️🔅 🔆〽️⚠️ 🚸🔱⚜️ 🔰♻️✅ 🈯💹❇️ ✳️❎🌐 💠Ⓜ️🌀 💤🏧🚾 ♿🅿️🈳 🈂🛂🛃 🛄🛅🛗 🚀🛸🚁 🚉🚆🚅 ✈️🛫🛬 🛩️💺🛰️