Integration with Business Systems

View Markdown

Last edited on 2026-06-30

To facilitate developers in integrating WeChat Business Manager with their business systems, the current implementation supports deploying the service provider's business module and the WeChat Business Manager module within the same service. Integration is achieved through internal invocation and forwarding operations within this service.

Developers can perform integration through the following features:

  • WeChat Business Manager supports receiving official WeChat messages and forwarding them to the service provider's business system.
  • WeChat Business Manager supports receiving external requests and routing them to the service provider's business system.
  • WeChat Business Manager centrally manages the lifecycle of third-party Tokens and supports integration with the service provider's business system.
  • Additionally, developers can read data from the WeChat Business Manager database to integrate with their business systems.

If you encounter any issues while using these features, you can provide feedback on the WeChat Open Platform Service Provider Zone.

1. Service Development and Deployment

How to deploy the service provider's business modules and the Micro Manager modules within the same service? You can refer to the steps below.

1.1 Modifying the Dockerfile

To better understand how to modify the Dockerfile to deploy the service provider's business modules and the WeChat Component (Weiguanjia) modules within the same service, developers can refer to the official demo for learning. This article is also based on this demo for explanation.

  1. Locate the Dockerfile for the service provider's business service. The following image uses the official demo "wxcloudrun-wxcomponent-flask" as an example:
  1. Add the following information to the Dockerfile and modify the startup command:
FROM ccr.ccs.tencentyun.com/weixincloud/weixincloud_wxcomponent:latest as wxcomponent
COPY --from=wxcomponent /wxcloudrun-wxcomponent /wxcloudrun-wxcomponent
ENV GIN_MODE release
  1. Write the start.sh startup script:
  1. Notes:
  • The business service must not listen on port 80 or port 8081 (WeChat Component is already listening on port 80; listen on any other port and fill it in the proxy configuration).
  • The business service must not respond to the following APIs (they are occupied by WeChat Component):
/
/wxcallback/*
/wxcomponent/*

1.2 Redeploy the Service

After modifying the Dockerfile for your Service Provider business service, simply re-upload the image and redeploy the service. You can follow the steps below to complete this process.

  1. Log in to WeChat Cloud Hosting from the Third-Party Platform (currently, access is only supported via redirection from the Third-Party Platform; direct access to the Cloud Hosting homepage for login is not supported). The specific path is: "Third-Party Platform - Details - Cloud Services - Go to WeChat Cloud Hosting". Clicking this will open the WeChat Cloud Hosting homepage with an active login session.

  2. Enter the Cloud Hosting console.

  1. Navigate to "Service List - Service Details" and click "Publish".
  1. [Optional] Before deploying, check if the service settings contain the following 4 configurations (these are set by default. If missing, you must configure them manually before deployment, otherwise the deployment will fail):
  1. Select the method to deploy the service using a compressed package, and upload the recently repackaged image.
  1. Wait for a short period until the deployment is complete.
  1. Experience the custom business logic.

Using the official demo wxcloudrun-wxcomponent-flask as an example, after completing the deployment following the development guide above, you can proceed to the proxy configuration. Once the port is set to 8080, you can access https://xxxxxx.ap-shanghai.run.tcloudbase.com/count.

II. Message Forwarding Configuration

After the business service is developed and deployed, configure message forwarding in Micro Admin.

2.1 Forwarding Pushes to the Authorized Event URL

A third-party platform account created by a service provider can receive event information pushed exclusively by WeChat to the service provider via "Authorization Event Configuration." Examples include:

  1. component_verify_ticket

  2. Authorization Change Notification

  3. Proxy Registration Mini Program Event

If the service provider's business system needs to receive this type of event information, it can be distinguished by infoType. Note that case sensitivity is strictly enforced. Taking the successful authorization notification as an example, infoType must be set to authorized. Setting it to Authorized will not work.

After completing the configuration, developers can perform a connectivity test:

If forwarding is no longer needed, you can disable the forwarder:

2.2 Forwarding Pushes to the Message and Event URL

Third-party platform accounts created by service providers can receive events or messages pushed by WeChat Official to Official Accounts or Mini Program via "Message and Event Configuration" (once the service provider obtains authorization from the Official Account or Mini Program, it can receive these on their behalf). Examples include:

  1. Nickname Review Result Event

  2. Code Review Result Event

  3. Delivery Order Status Update Notification Event

  4. Official Account Common Messages

If your service provider's business system needs to receive such event information, you can distinguish it using MsgType. Note that case sensitivity is strictly enforced. If MsgType is Event, you must further specify the Event name, such as weapp_audit_success.

3. Proxying External Requests

WeCom supports proxy configuration. When proxy is enabled, external requests can be transparently forwarded to internal business services, enabling integration between WeCom and other business systems.

4. Data Integration

The database structure of Weiguanjia is as follows. Developers can directly access the database to read data.

V. Unified Token Management

The Token service on port 8081 of WeiGuanJia listens only on 127.0.0.1 and requires no authentication. Developers can call it via HTTP to obtain a valid Token without handling token expiration (i.e., the Token retrieved via this API is guaranteed to be valid and non-expired).

  • How to retrieve component_access_token: http://127.0.0.1:8081/inner/component-access-token
  • How to retrieve authorizer_access_token: http://127.0.0.1:8081/inner/authorizer-access-token?appid=xxxx

Note: If developers independently develop other services that also refresh Tokens, it may result in the component_access_token and authorizer_access_token retrieved via the above methods not being the latest ones.