SuperAPI AI Directory

chatgpt-for-chatbot-feishu

chatgpt-for-chatbot-feishu is an open-source project for quickly integrating ChatGPT into Feishu, based on the official OpenAI API, and can serve as a personal work assistant or enterprise employee assistant. It supports group chats, @bot replies, command triggers (/chatgpt your question), and allows customization of the OpenAI model, language, context, and more. The project provides multiple deployment methods such as one-click deployment, binary, and Docker Compose, and supports secondary development using Go language frameworks such as Go-Zoox, Gin, Echo, and Go-Zero. By configuring the Feishu app and OpenAI API Key, you can use ChatGPT features in Feishu.

Open website

About this tool

chatgpt-for-chatbot-feishu is an open-source project designed to quickly integrate ChatGPT into Feishu, based on the official OpenAI API, and can serve as a personal work assistant or enterprise employee assistant. The project is developed in Go and provides multiple deployment options and rich configuration options.

Purpose

The main purpose of this project is to integrate ChatGPT into the Feishu platform, enabling Feishu users to interact with ChatGPT through group chats or private chats and obtain intelligent replies. It is suitable for individual users as a work assistant, and also for enterprises as an employee assistant, improving communication and collaboration efficiency.

Main capabilities

  • Supports group chats and @bot replies, and also supports command triggers, in the format /chatgpt 你的问题.
  • Supports custom OpenAI models. You can use the command /model to get the current session model. Administrators can use /model <model> to set the model, for example /model gpt-4.
  • Supports custom language and context, configured through environment variables.
  • Supports configuring a startup reverse proxy, such as cpolar, ngrok, and natapp.
  • Supports secondary development, allowing quick integration into existing enterprise applications, using Go development frameworks such as Go-Zoox, Gin, Echo, and Go-Zero.
  • Built-in online (/online) and offline (/offline) commands, supporting setting administrators (ADMIN_ENV) and custom offline auto-reply content (OFFLINE_MESSAGE).
  • Supports privately deployed Feishu (FEISHU_BASE_URI).
  • Supports event encryption (ENCRYPT_KEY) and Challenge verification (VERIFICATION_TOKEN).
  • Fixed the issue of Feishu resending messages due to network reasons, allowing duplicate messages to be ignored from the chatbot side.

Usage

  1. Obtain an OpenAI API Key.
  2. Create a Feishu bot: go to the Feishu Developer Platform to create an app and obtain the AppID and AppSecret; add app capability => bot, and create a bot; obtain a public network address from cpolar or serverless, and fill in the callback address in the event subscription section of the Feishu bot backend (the default API path is /, which can be customized through the environment variable API_PATH, for example /webhook/event).
  3. Add callback events: receive group messages (im.message.receive_v1), message recalled (im.message.recalled_v1), bot added to group (im.chat.member.bot.added_v1), bot removed from group (im.chat.member.bot.deleted_v1).
  4. Add permissions: get and send single chat and group messages (im:message), send messages as the app (im:message:send_as_bot), get single chat messages sent by users to the bot (im:message.p2p_msg), read single chat messages sent by users to the bot (im:message.p2p_msg:readonly), get all messages in a group (im:message.group_msg), get messages in which users @mention the bot in a group (im:message.group_at_msg), receive @mention bot message events in group chats (im:message.group_at_msg:readonly), get and update group information (im:chat), get group information (im:chat:readonly), [optional] get user information (contact:contact:readonly_as_app, required if the administrator ADMIN_EMAIL is set).
  5. Publish the version and wait for enterprise administrator approval.
  6. Deploy the project: you can choose one-click deployment (recommended), binary, Docker Compose, or secondary development.
  7. Configure environment variables: including API_PATH, ENCRYPT_KEY, VERIFICATION_TOKEN, SITE_URL, OPENAI_MODEL, FEISHU_BASE_URI, CHATGPT_CONTEXT_MESSAGE, CHATGPT_LANGUAGE, TUNNEL_ENABLE, TUNNEL_TYPE, AUTH_TOKEN, SUBDOMAIN, LOGS_DIR, ADMIN_EMAIL, OFFLINE_MESSAGE, etc.

Applicable Scenarios

  • Individual users: as a personal work assistant, quickly obtain ChatGPT's intelligent replies in Feishu.
  • Enterprise users: as an employee assistant, integrated into the enterprise Feishu app to improve internal communication efficiency.
  • Developers: carry out secondary development based on the project and quickly integrate it into the enterprise's existing applications.

Limitations

  • The project is based on the official OpenAI interface and requires a valid OpenAI API Key.
  • The Feishu app needs to be configured and the corresponding permissions obtained; the process may involve enterprise administrator review.
  • Some features (such as custom models and administrator settings) may require specific permissions or configuration.
  • The project documentation does not mention detailed information such as fees, pricing, or platform compatibility, so it is not provided for now.