Get WeCom QR binding credentials¶
Obtain credentials for a WeCom QR binding.
POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/ingress-connections/wecom-qr
Before you call this API¶
Prepare a personal access token with access to the target workspace and permission for the action. The path workspace must match X-Workspace-ID. Examples use jq. See common information for variables, objects, and states.
Request body¶
curl -X POST "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/ingress-connections/wecom-qr" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
--data-binary "$(jq -n --arg AGENT_WORKSPACE_ID "$AGENT_WORKSPACE_ID" --arg AGENT_ID "$AGENT_ID" '
{
"target": {
"kind": "agent",
"workspace_id": $AGENT_WORKSPACE_ID,
"id": $AGENT_ID
}
}
')"
The first response contains a QR URL, session token, and expiration time. Subsequent requests use the original session_token to query pending/authorized/expired. Sessions last 5 minutes; obey Retry-After on 429 responses. An authorized response returns bot_id/secret for creating a wecom/managed_stream connection. This action does not save a real connection. Handle tokens and secrets only in a protected client, without logging them.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
object |
Yes |
Agent or team receiving messages. |
|
string |
Yes |
agent or team. |
|
string |
Yes |
Target source workspace. Teams belong to the current workspace; agents belong to the current or system workspace. |
|
string |
Yes |
Target ID returned by the catalog. |
|
string |
No |
Omit initially. For subsequent queries, retain the original value returned for the same workspace, account, and target. |
Successful response¶
{
"code": 0,
"data": {
"status": "pending",
"session_token": "opaque_example",
"qr_url": "https://work.weixin.qq.com/example",
"expires_at": "2026-11-11T00:05:00Z"
}
}
Field |
Type |
Description |
|---|---|---|
|
integer |
0 on success. |
|
object |
Result object; see common objects for fields. |
Error responses¶
Handle the HTTP status, business result, and error fields as described in errors and environments. On source or version conflicts, read the current state. Do not automatically replace identities, resources, or request IDs and retry.