Generate enterprise WeChat callback key

Generate random key material required for enterprise WeChat callback verification. The key is only returned in this response; please save it immediately in a controlled environment and do not write it to the code repository, logs or screenshots.

POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/tools/wecom/callback-secrets/generate

Before you call

Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

  • $AI_STUDIO_API_KEY: The actual personal access token, passed through the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

The request body of this interface must be empty.

Request example

curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/tools/wecom/callback-secrets/generate" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Path parameters

Parameters

Type

Is it required

Description

workspace_id

string

Yes

The current workspace ID.

Successful response

Returns 200 on success. Each call generates a new set of random values, and the interface does not save or echo previously generated values.

{
  "code": 0,
  "data": {
    "callback_token": "<32_CHARACTER_HEX_TOKEN>",
    "callback_encoding_aes_key": "<43_CHARACTER_BASE64_KEY>"
  }
}

The response fields are as follows.

Field

Type

Description

code

integer

0 on success.

data.callback_token

string

Callback Token composed of 32 hexadecimal characters.

data.callback_encoding_aes_key

string

43-character Base64 encoded AES key without trailing padding.

Error response

{
  "code": 1,
  "message": "<错误信息>"
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

401

6UNAUTHENTICATED

Lack of valid identity credentials.

Check API Key.

403

5PERMISSION_DENIED

The current identity does not have permission to generate callback keys.

Check workspace authorization.

500

1INTERNAL

The service failed to generate random key material.

Regenerate later; do not reuse incomplete responses.

Follow-up operations

Save the returned key or ID, and check the relevant configuration if necessary Query GitHub tool connection.

Last updated on