WeChat Enhanced icon

WeChat Enhanced

WeChat Enhanced Node - Suporte completo para Mini Programs, Official Accounts, WeChat Pay e WeChat Work

Overview

This node, part of the "WeChat Enhanced" integration, provides comprehensive support for various WeChat services including Mini Programs, Official Accounts, WeChat Pay, and WeChat Work. Specifically, for the Mini Program resource with the Code to Session operation, it exchanges a WeChat login code for session information. This is typically used in authentication flows where a client-side Mini Program obtains a temporary login code from WeChat, which then needs to be exchanged on the backend for user session details such as openId and sessionKey.

Common scenarios:

  • Authenticating users in a WeChat Mini Program by exchanging the login code received after user login.
  • Retrieving session info to maintain user sessions or fetch further user data securely.
  • Integrating WeChat Mini Program login into workflows that require user identification or authorization.

Practical example:
A developer building a workflow to authenticate users via a WeChat Mini Program can use this node to send the login code obtained from the Mini Program frontend and receive session details needed to identify the user and manage their session.


Properties

Name Meaning
Code The WeChat login code obtained from the Mini Program frontend after user login. This code is required to exchange for session information.

Output

The output JSON contains the session information returned by WeChat after exchanging the login code. Typically, this includes fields such as:

  • openid: The unique identifier for the user within the Mini Program.
  • session_key: A session key used for encrypting/decrypting user data.
  • Possibly other fields like unionid if available.

This output allows subsequent nodes or processes to use the user's identity and session context.

The node does not output binary data for this operation.


Dependencies

  • Requires an active subscription and valid API key credential for the external "N8N Tools API" service, which acts as a proxy or validation layer for WeChat API calls.
  • Requires credentials for WeChat API access (e.g., app ID and secret) configured in n8n.
  • The node internally uses a helper class to interact with WeChat's Mini Program API endpoints.

Troubleshooting

  • Invalid subscription or API key error: If the node throws an error indicating invalid subscription or API key, verify that the API key credential is correctly set up and active.
  • Unsupported operation error: Ensure the operation selected matches the resource; for example, "code2Session" must be used with the "Mini Program" resource.
  • Missing or invalid code parameter: The "Code" property is required and must be a valid WeChat login code. An empty or incorrect code will cause the API call to fail.
  • Network or API errors: Check network connectivity and WeChat API status if requests fail unexpectedly.
  • Continue on Fail: If enabled, the node will output error messages in the JSON output instead of stopping execution, useful for debugging batch inputs.

Links and References


This summary focuses on the "Mini Program" resource and the "Code to Session" operation as requested.

Discussion