Overseas access: www.kdjingpai.com
Ctrl + D Favorites

Cloudflare-WX-API is an open source project hosted on GitHub that aims to help developers combine WeChat Service Number with the Cloudflare platform to realize CAPTCHA login, code-sweeping login, and intelligent auto-reply functions based on Large Language Model (LLM). Developed by Tinger-X, the project is suitable for individual developers or small teams to quickly build automation features for WeChat Service Number. The project uses Cloudflare Workers to provide efficient server-side support, combined with the WeChat API to realize user authentication and message processing. By integrating LLM, developers can realize intelligent message replies and improve user interaction experience. The whole project aims to be simple and easy to use, with open code and clear documentation, suitable for users with a certain programming foundation.

Function List

  • WeChat service number access: support rapid configuration of WeChat service number, complete API docking.
  • CAPTCHA Login: Provide WeChat-based CAPTCHA login function to simplify the user authentication process.
  • Sweep code login: Support users to log in through WeChat sweep code, suitable for rapid identity verification in a variety of scenarios.
  • Intelligent Auto-Reply: Integrate Large Language Model (LLM) to realize context-sensitive intelligent message replies.
  • Cloudflare Workers Support: Leverage Cloudflare's serverless architecture for efficient and low-cost deployment.
  • Open source code: complete code and documentation is provided for developers to easily customize the functionality.
  • Lightweight Configuration: Initial setup can be done with a simple configuration file.

Using Help

Installation and Configuration

To use Cloudflare-WX-API, you first need to prepare the following environment:

  1. GitHub Account: Access https://github.com/Tinger-X/cloudflare-wx-apiClick "Fork" or "Clone" to download the project locally.
  2. Cloudflare Account: Register for a Cloudflare account and enable the Workers feature. Log in to your Cloudflare dashboard and go to the "Workers" page to create a new project.
  3. WeChat Developer Platform: Register for a WeChat public platform account, create a service number, and get an AppID and AppSecret.
  4. Node.js Environment: Ensure that Node.js (recommended version 16 or higher) is installed locally for running and testing the project.

Installation steps::

  1. Cloning projects to local:
    git clone https://github.com/Tinger-X/cloudflare-wx-api.git
    cd cloudflare-wx-api
    
  2. Install the dependencies:
    npm install
    
  3. Configure environment variables:
    • In the project root directory, create the .env file, add the following:
      WECHAT_APP_ID=你的微信AppID
      WECHAT_APP_SECRET=你的微信AppSecret
      CLOUDFLARE_API_TOKEN=你的Cloudflare API令牌
      LLM_API_KEY=你的LLM服务API密钥
      
  4. Deploy to Cloudflare Workers:
    • Log in using the Wrangler CLI tool (Cloudflare's command line tool):
      npx wrangler login
      
    • Deployment projects:
      npx wrangler deploy
      
    • When deployment is complete, the Wrangler returns a URL (e.g. https://your-project.workers.dev) for microsoft service number configuration.

WeChat Service Number Configuration::

  1. Log in to WeChat Public Platform and go to "Development - Basic Configuration".
  2. In "Server Configuration", fill in the following fields:
    • Server address (URL): Fill in the URL provided by Cloudflare Workers.
    • Token: Customize the settings in the project configuration file.
    • message encryption and decryption key: Generate a random key and save it.
  3. Submit the configuration and verify that the server is successfully connected to the WeChat service number.

Functional operation flow

CAPTCHA Login

  1. The user triggers a login request on the front-end and the system sends a verification code to the user's WeChat.
  2. The user enters a verification code and the project passes /verify Endpoint checksum validation code.
  3. Upon successful authentication, user authentication information (e.g., OpenID) is returned for subsequent operations.
    • Example of operation: Users visit your webpage, click "WeChat Login", enter the verification code received, and the system automatically completes the authentication.

Swipe to log in

  1. The project generates a dynamic QR code that users scan using WeChat.
  2. After scanning, the WeChat server calls back the URL configured by the project to pass the user identity information.
  3. The system handles callbacks to complete the user login.
    • Operation example: user scans the QR code on the webpage, WeChat jumps to the authorization page, and logs in automatically after confirmation.

Intelligent Auto-Responder

  1. The user sends a message to the WeChat service number, triggering Cloudflare Workers to process it.
  2. The project calls the LLM API (e.g. OpenAI or other models) to generate context-sensitive responses.
  3. The response is returned to the user via the WeChat API.
    • Example of operation: User sends "What is the weather tomorrow?" , the service number replies "Please enter the name of the city, I will check the weather for you" or return the weather information directly.

Customized Functions

Developer may modify index.js file to add custom logic. For example, add message filtering, keyword triggering or multi-language support. The project supports modular expansion , developers can access other APIs according to demand .

caveat

  • safety: To ensure that .env The key in the file is not disclosed and uploading to public repositories is avoided.
  • adjust components during testing: Use npx wrangler dev Test Workers functionality locally.
  • documentation reference: Detailed documentation is available on the project's GitHub page at README.md cap (a poem) DOCS Folder.
  • Update Maintenance: Periodically check version compatibility between Cloudflare Workers and the WeChat API.

application scenario

  1. Individual developers quickly build WeChat service number
    Individual developers can use Cloudflare-WX-API to quickly realize the login and message reply function of WeChat service number, without complex server configuration, suitable for rapid prototyping.
  2. E-commerce platform user authentication
    E-commerce websites can simplify the user authentication process, enhance user experience and lower the registration threshold by scanning code login or verification code login.
  3. Intelligent Customer Service System
    Enterprises can use intelligent autoresponders to build a 24/7 customer service system to answer frequently asked questions and reduce the burden of manual customer service.
  4. Educational or community interaction platforms
    Online education or community platforms can interact with users through WeChat service numbers, push course reminders or event notifications, and provide personalized responses through LLM.

QA

  1. Need a server?
    Not required. The project is based on Cloudflare Workers, eliminating the need for traditional servers, making deployment easy and inexpensive.
  2. What large language models are supported?
    The project supports any LLM that provides an API, such as OpenAI, Anthropic, etc., which needs to be added in the .env Configure the API key in the
  3. How to debug microsoft callbacks?
    utilization npx wrangler dev Start the local server and verify the callback function in conjunction with the WeChat public platform test number.
  4. Does it support multi-language responses?
    Default support for Chinese responses, developers can modify the code to access the multi-language LLM or translation API.
0Bookmarked
0kudos

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

inbox

Contact Us

Top

en_USEnglish