The Feishu CLI Complete Guide: Installation, Deployment, and Real-World Integration With Claude Code

Introduction

In today’s fast-iterating development and operations environments, command-line tools have become the key lever for productivity. Feishu — ByteDance’s enterprise collaboration platform — exposes a rich Open API surface, and through its CLI, developers can automate message sending, group management, and bot interactions. Meanwhile, Claude Code, Anthropic’s AI coding assistant, is redefining how developers work. This guide covers installing and deploying the Feishu CLI in detail, then wiring it together with Claude Code into intelligent team-collaboration workflows.

Chapter 1: Feishu CLI Overview

The Feishu CLI is a command-line tool built on the Feishu Open Platform API, letting developers interact with Feishu from the terminal. Compared with a graphical interface, the CLI offers higher flexibility and programmability — ideal for automation scripts and CI/CD scenarios. Through it you can: send text, image, and card messages; manage group members and settings; create and edit documents; call the full Open API surface; and implement custom bot functionality.

Its advantages over raw API calls: a simplified development flow — no complex HTTP request code, just clear commands; a lower learning curve through familiar terminal interaction; automation support — trivially embedded in scripts and scheduled jobs; and cross-platform availability across macOS, Linux, and Windows.

Chapter 2: Installation and Configuration

Environment prerequisites

  • OS: macOS 10.15+ / Ubuntu 20.04+ / Windows 10+
  • Node.js 14.0.0 or higher
  • npm or yarn package manager
  • A Feishu enterprise admin account (to create the app and obtain App ID and App Secret)

Install the CLI

npm install -g @feishu/cli
yarn global add @feishu/cli

Verify:

feishu --version

Configure app credentials

Before using the CLI, create an app on the Feishu Open Platform: visit open.feishu.cn, log in with an enterprise admin account, complete the app-creation form, retrieve the App ID and App Secret from the credentials page, and add the API permissions you need under permission management. Common permissions include im:resource:chat (send messages), im:chat:member (read group members), and im:message:send_as_bot (send as bot).

Initialize CLI configuration

feishu config init
# enter your App ID and App Secret at the prompts

Configuration lands in ~/.feishu/config.json.

Chapter 3: Core Features in Practice

Sending messages

feishu message send --chat-id chat_id --content "Hello World"

Rich text:

feishu message send-rich --chat-id chat_id --title "Title" --content "<h1>Rich text content</h1>"

Images:

feishu message send-image --chat-id chat-id --image-path /path/to/image.png

Group management

feishu chat create --name "Project Discussion" --user-id-list "user1,user2"
feishu chat add-member --chat-id chat_id --user-id-list "user3,user4"
feishu chat list

Bot development

feishu bot create --name "Weather Bot"

After configuring the bot’s callback URL, it can receive messages and auto-reply.

Chapter 4: Claude Code in Brief

Claude Code is Anthropic’s AI coding assistant, built on the Claude large language model and optimized for programming tasks. Unlike traditional completion tools, it understands whole-codebase context and delivers intelligent suggestions, refactoring, and automatic test generation. Its core capabilities: context-aware code completion; code explanation for untangling complex logic; automatic test generation; refactoring with applied optimizations; and conversational programming through natural language.

Install Claude Code

npm install -g @anthropic-ai/claude-code
curl -fsSL https://claude.com/install.sh | sh
claude config init
# enter your API key from the Anthropic console

Chapter 5: Integration Scenarios

Combining the two unlocks workflows neither tool delivers alone:

  • Smart message generation: Claude Code analyzes the repository and generates a daily dev digest pushed to a Feishu group
  • Automated code review: a GitHub pull request triggers a Claude Code review, with results notified through Feishu
  • Intelligent support bot: an assistant that answers technical questions using Claude’s capability
  • Log analysis and alerting: Claude Code digests error logs and pushes solutions to developers

Scenario 1: Daily dev digest, auto-pushed

#!/bin/bash
# daily development digest

# generate the code summary with Claude Code
CLAUDE_OUTPUT=$(claude analyze ./src --summary)

# push to the Feishu group
feishu message send-rich \
  --chat-id "your_chat_id" \
  --title "Daily Dev Digest" \
  --content "$CLAUDE_OUTPUT"

Scenario 2: The smart code-review assistant

#!/bin/bash
# PR review script

PR_URL=$1
BRANCH=$2

# review the changes with Claude Code
REVIEW_RESULT=$(claude code-review --pr "$PR_URL" --format json)

# extract the findings
SUMMARY=$(echo $REVIEW_RESULT | jq -r '.summary')
ISSUES=$(echo $REVIEW_RESULT | jq -r '.issues[]')

# send results through Feishu
feishu message send-rich \
  --chat-id "code_review_group" \
  --title "Code Review: $BRANCH" \
  --content "$SUMMARY\n\n$ISSUES"

Scenario 3: An intelligent support bot

const { Client } = require('@feishu/cli');
const { Claude } = require('@anthropic-ai/claude-code');

class SmartBot {
  constructor() {
    this.feishu = new Client();
    this.claude = new Claude();
  }

  async handleMessage(message) {
    const userInput = message.content.text;

    // Claude interprets intent and drafts the reply
    const response = await this.claude.chat({
      messages: [{role: 'user', content: userInput}],
      system: 'You are a professional technical support engineer,'
        + ' skilled at programming, deployment, and API questions.'
    });

    // deliver through Feishu
    await this.feishu.message.send({
      chat_id: message.chat_id,
      msg_type: 'text',
      content: {text: response.content}
    });
  }
}

Scenario 4: Automated problem diagnosis

#!/usr/bin/env node
// error-log analysis and diagnosis

const feishu = require('@feishu/cli');
const claude = require('@anthropic-ai/claude-code');
const fs = require('fs');

async function diagnoseError(errorLogPath) {
  const errorLog = fs.readFileSync(errorLogPath, 'utf-8');

  const diagnosis = await claude.chat({
    messages: [{
      role: 'user',
      content: `Analyze this error log; give likely causes and fixes:\n\n${errorLog}`
    }],
    system: 'You are a senior full-stack engineer, expert at locating and solving technical problems.'
  });

  await feishu.message.send({
    chat_id: process.env.ERROR_NOTIFY_CHAT,
    msg_type: 'rich_text',
    content: {
      title: 'Error Diagnosis Report',
      content: diagnosis.content
    }
  });
}

diagnoseError('./error.log');

Chapter 6: Best Practices and Performance

Configuration best practices

  • Credential security: store secrets in environment variables; never hard-code them
  • Error handling: add retry logic and timeouts to every CLI call
  • Logging: record key operations for troubleshooting
  • Least privilege: request only the API permissions the business requires

Performance optimizations

  • Batch operations: use batch interfaces instead of loops for multi-message sends
  • Caching: cache infrequently changing data like group membership locally
  • Concurrency control: set sensible limits to avoid triggering Feishu’s API rate limits
  • Connection reuse: keep HTTP connections alive to cut handshake overhead

Monitoring and alerting

#!/bin/bash

# check the CLI runs at all
if ! feishu --version > /dev/null 2>&1; then
  echo "Feishu CLI abnormal" | mail -s "Alert" [email protected]
fi

# check message-send success rate
SUCCESS_RATE=$(feishu stats --period 1h | jq '.success_rate')
if (( $(echo "$SUCCESS_RATE < 0.95" | bc -l) )); then
  feishu message send --chat-id alert --content "Warning: success rate below 95%"
fi

Chapter 7: Advanced Topics

Custom commands

feishu command create mycommand --handler ./mycommand.js

CI/CD integration

# .gitlab-ci.yml example
deploy:
  stage: deploy
  script:
    - npm install -g @feishu/cli
    - feishu config init
    - feishu message send --chat-id deploy-notify --content "Deploy started $CI_COMMIT_SHA"
  only:
    - main

Multi-tenant management

# add tenant configurations
feishu config add --tenant tenant_a --app-id xxx --app-secret yyy
feishu config add --tenant tenant_b --app-id zzz --app-secret www

# switch tenants
feishu config use tenant_a

The Bottom Line

The Feishu CLI gives developers powerful command-line access to their collaboration platform, and Claude Code brings a revolutionary AI programming experience. Combined, they measurably raise team efficiency and enable genuinely intelligent collaboration workflows. This guide covered the full install-and-deploy path and the core integration patterns — daily digests, PR reviews, support bots, and error diagnosis — and from here the interesting work is yours: the most valuable automations are always the ones wired into your team’s specific friction. As AI tooling matures, expect deeper fusions of CLI infrastructure and AI reasoning, delivering smarter and more efficient developer experiences. Tools and platforms covered: Feishu Open Platform, Claude Code, Anthropic.

Related News