Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 26, 2025

概述 / Overview

WeCom has IP whitelist requirements. Users previously had to override api.py files to route calls through a reverse proxy with fixed IPs, causing update conflicts. This adds optional api_base_url configuration to WeCom adapters.

Usage:

{
  "corpid": "ww1234567890abcdef",
  "secret": "your_secret",
  "token": "your_token",
  "EncodingAESKey": "your_aes_key",
  "contacts_secret": "your_contacts_secret",
  "api_base_url": "https://your-proxy.example.com/wecom-api"
}

Changes:

  • libs/wecom_api/api.py: Added api_base_url parameter to WecomClient.__init__(), default https://qyapi.weixin.qq.com/cgi-bin
  • libs/wecom_customer_service_api/api.py: Added api_base_url parameter to WecomCSClient.__init__(), same default
  • platform/sources/wecom.py: Pass config.get('api_base_url', default) to client
  • platform/sources/wecomcs.py: Pass config.get('api_base_url', default) to client

Backward compatible: omitting api_base_url uses default WeCom API endpoint.

更改前后对比截图 / Screenshots

修改前 / Before:

  • Users must override library files to use reverse proxy
  • Files get overwritten on update, breaking custom configurations

修改后 / After:

  • Configuration-based: add api_base_url to adapter config
  • Clean upgrades without losing reverse proxy settings

检查清单 / Checklist

PR 作者完成 / For PR author

  • 阅读仓库贡献指引了吗? / Have you read the contribution guide?
  • 与项目所有者沟通过了吗? / Have you communicated with the project maintainer?
  • 我确定已自行测试所作的更改,确保功能符合预期。 / I have tested the changes and ensured they work as expected.

项目维护者完成 / For project maintainer

  • 相关 issues 链接了吗? / Have you linked the related issues?
  • 配置项写好了吗?迁移写好了吗?生效了吗? / Have you written the configuration items? Have you written the migration? Has it taken effect?
  • 依赖加到 pyproject.toml 和 core/bootutils/deps.py 了吗 / Have you added the dependencies to pyproject.toml and core/bootutils/deps.py?
  • 文档编写了吗? / Have you written the documentation?
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: 期望支持配置企微api地址</issue_title>
<issue_description>### 这是一个?

新功能

详细描述

企微有IP白名单,希望能自定义api地址,以使用固定公网IP服务器的反代地址,目前是通过覆盖api.py实现,但是会由于更新产生变动</issue_description>

<agent_instructions>适配一下,要求可以在适配器配置里填写,底层传给libs/ 里的api,做好对旧版的兼容性,写好默认值;</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@RockChinQ 欢迎pr,这个你可以直接让 @copilot 来写,然后你review一下就好

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for custom API address configuration feat: support configurable WeCom API base URL for reverse proxy deployment Dec 26, 2025
Copilot AI requested a review from RockChinQ December 26, 2025 08:27
@RockChinQ RockChinQ marked this pull request as ready for review December 26, 2025 08:38
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. eh: Feature enhance: 新功能添加 / add new features IM: wecom 企业微信 适配器相关 / WeCom and WeComCS adapter related m: Platform 机器人管理相关 / Bots management pd: Need testing pending: 待测试的PR / PR waiting to be tested labels Dec 26, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Dec 28, 2025
@RockChinQ RockChinQ merged commit 30945aa into master Dec 28, 2025
1 check passed
@RockChinQ RockChinQ deleted the copilot/add-custom-api-address-support branch December 28, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eh: Feature enhance: 新功能添加 / add new features IM: wecom 企业微信 适配器相关 / WeCom and WeComCS adapter related m: Platform 机器人管理相关 / Bots management pd: Need testing pending: 待测试的PR / PR waiting to be tested size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: 期望支持配置企微api地址

2 participants