Overview

This tutorial will guide you through integrating a WeChat Official Account in Pathors, including creating an official account application, obtaining AppID and AppSecret, configuring the integration in Pathors, and setting up the webhook URL.

Prerequisites

Before starting, you need:
  • A WeChat Official Account (Service Account or Subscription Account)
  • Access to WeChat Official Accounts Platform
  • Developer permissions for the official account

Step 1: Obtain WeChat Official Account Credentials

Before configuring the integration in Pathors, you need to obtain your AppID and AppSecret from the WeChat Official Accounts Platform.

Getting Your AppID and AppSecret:

  1. Access WeChat Platform: Visit WeChat Official Accounts Platform and log in with your official account credentials
  2. Navigate to Basic Configuration:
    • In the left sidebar, find and click on “开发” (Development)
    • Select “基本配置” (Basic Configuration)
  3. Locate AppID:
    • Your AppID is displayed prominently at the top of the page
    • Format: wx followed by 16 hexadecimal characters (e.g., wx1234567890abcdef)
    • Copy this AppID for use in Pathors
  4. Generate AppSecret:
    • Look for the “AppSecret” section
    • If you haven’t generated one before, click “生成” (Generate) button
    • If you have one but need to reset it, click “重置” (Reset) button
    • ⚠️ Critical: The AppSecret will only be shown once - copy and save it immediately
    • Format: 32 hexadecimal characters (e.g., 1234567890abcdef1234567890abcdef)

Important: Keep your credentials secure! Never share your AppSecret publicly or commit it to version control.

Step 2: Configure WeChat Integration in Pathors

Now that you have your WeChat credentials, let’s set up the integration in Pathors.

Enable the Integration

  1. Access Integration Page:
    • Log into your Pathors project
    • Navigate to the “Integrations” page
    • Find the WeChat integration card (with WeChat logo)
  2. Enable Integration:
    • Click the toggle switch in the top right corner to enable WeChat integration
    • The card will become active and form fields will be enabled
Enable WeChat Integration in Pathors

Configure Your Credentials

  1. Enter AppID:
    • Paste the AppID you copied from WeChat Official Accounts Platform
    • Format should be: wx + 16 hexadecimal characters
  2. Enter AppSecret:
    • Paste the AppSecret you copied from WeChat Official Accounts Platform
    • Format should be: 32 hexadecimal characters
    • This field is password-protected for security
  3. Test Your Credentials:
    • Click the “Test Credentials” button
    • This verifies that your AppID and AppSecret are valid
    • If successful, you’ll see a green confirmation message
Configure WeChat Credentials

Optional: Generate Security Token

  1. Generate Token (Recommended):
    • Click the shuffle icon (🔀) next to the Token field to auto-generate a secure token
    • Or enter your own custom token (3-32 alphanumeric characters)
    • This token adds extra security for webhook verification
  2. Save Configuration:
    • Click the “Save” button to store your settings
    • All fields will be saved and the integration will be ready
Save WeChat Configuration

Step 3: Set Up Webhook URL

The final step is configuring the webhook URL so WeChat can send messages to your Pathors assistant.

Copy Webhook URL from Pathors

  1. Find Webhook Section:
    • Scroll down to the “Webhook Settings” section in Pathors
    • You’ll see an automatically generated webhook URL
    • Click the copy button to copy this URL
Copy Webhook URL from Pathors

Configure Server Settings in WeChat Platform

  1. Return to WeChat Platform:
  2. Find Server Configuration Section:
    • Look for “服务器配置” (Server Configuration) section
    • Click “修改配置” (Modify Configuration) if needed
  3. Enter Server Details:
    • 服务器地址(URL): Paste the webhook URL you copied from Pathors
    • 令牌(Token): Enter the same token you configured in Pathors (if you set one)
    • 消息加解密密钥(EncodingAESKey): You can generate one or leave blank for plain text mode
    • 消息加解密方式: Choose “明文模式” (Plain text mode) for simplicity
  4. Submit and Enable:
    • Click “提交” (Submit) to save the server configuration
    • WeChat will verify the webhook URL by sending a test request
    • If verification is successful, click “启用” (Enable) to activate the server configuration

Verification Process: WeChat will send a GET request to your webhook URL to verify it’s working. Pathors handles this verification automatically.

Step 4: Test Your WeChat Integration

Once everything is configured, it’s time to test your WeChat bot!
  1. Find Your Official Account:
    • Use the WeChat mobile app to scan your official account’s QR code
    • Or search for your official account name in WeChat
  2. Follow and Test:
    • Follow/subscribe to your official account
    • Send a message to start chatting with your Pathors AI assistant
    • The assistant should respond based on your configured workflow
  3. Verify Integration:
    • Check that messages appear in your Pathors session history
    • Confirm that responses are being sent back to WeChat
    • Test different types of messages (text, images if supported)

Important Notes

  • AppID Format: AppID should start with “wx” followed by 16 hexadecimal characters (e.g., wx1234567890abcdef)
  • AppSecret Format: AppSecret should be 32 hexadecimal characters (e.g., 1234567890abcdef1234567890abcdef)
  • Security: Keep your AppSecret secure and never share it publicly
  • Enable Order: You must first enable the integration toggle before entering and saving credentials
  • Token Requirement: Token is optional but recommended for webhook security verification
  • Auto Menu: Pathors automatically manages the WeChat menu for your official account

WeChat Platform Configuration Steps

The webhook URL configuration in WeChat Official Accounts Platform involves these steps:
  1. Log into WeChat Official Accounts Platform
  2. Go to Development → Basic Configuration
  3. In Server Configuration section, enter the webhook URL from Pathors
  4. Enter the same token used in Pathors (if configured)
  5. Choose appropriate message encryption settings
  6. Submit and enable the server configuration

Common Issues

Q: Why can’t I save the AppID and AppSecret?

A: Please ensure you have enabled the WeChat integration toggle (the switch button in the top right corner).

Q: Credentials test failed, what should I do?

A: Please check:
  • AppID format is correct (starts with “wx” followed by 16 hex characters)
  • AppSecret format is correct (32 hex characters)
  • Credentials were copied correctly from WeChat Official Accounts Platform
  • Your official account has developer permissions enabled

Q: Webhook URL verification failed in WeChat platform?

A: Please ensure:
  • The webhook URL from Pathors is correctly entered in WeChat platform
  • Token matches between Pathors and WeChat platform (if using token verification)
  • Your Pathors integration is enabled and credentials are saved
  • Network connectivity allows WeChat to reach the webhook URL

Q: Messages are not being received?

A: Please verify:
  • Server configuration is enabled in WeChat Official Accounts Platform
  • Webhook URL is correctly configured and verified
  • Integration is enabled in Pathors with valid credentials
  • Users have followed your official account