Skip to main content

Configure QMind data sources

Set up Feishu or DingTalk app credentials and grant QMind access to the resources you want to import.

This guide is for knowledge base owners and administrators. Prepare a small document for a test import. In your QMind knowledge base, open Add sources, select Data sources, then choose Feishu or DingTalk.
Data sourceQMind form fieldsWho grants access
Feishu WikiEnter the App ID in app_id and the App Secret in app_secret.A wiki space administrator grants access to the Feishu app.
Feishu DriveEnter the App ID in app_id and the App Secret in app_secret. Paste the target folder URL into Drive folder link.The folder or document owner grants access to the Feishu app.
DingTalkEnter the Client ID (AppKey) in client_id, the Client Secret (AppSecret) in client_secret, and the employee's Union ID in Operator unionId.A knowledge base administrator grants access to the operator.
API permissions determine which endpoints an app can call. Resource access determines which spaces, folders, and documents those calls can read. Copy secrets directly from the developer console into QMind.

Feishu

Create an app and enable permissions

  1. In the Feishu organization that owns the source documents, open the developer console and create a custom app for your organization. Open Credentials & Basic Information (凭证与基础信息) and copy the App ID and App Secret for the same app. Feishu Developer Console · Get a tenant access token for a custom app
    Feishu developer console showing where to find the app credentials
  2. Under Development Configuration → Permissions Management (开发配置 → 权限管理), select Enable permissions (开通权限). The two app identity scopes below are the minimum required to import modern Feishu Docs from a wiki. Copy each scope ID to search for it and enable it.
    • View wiki (查看知识库) wiki:wiki:readonly allows the app to list wiki spaces and child nodes. List wiki spaces · List child nodes
    • View modern Feishu Docs (查看新版文档) docx:document:readonly allows the app to read document content.
    Feishu Permissions Management showing both wiki and document read scopes enabled for the app identity
    To import a Feishu Drive folder with mixed file types, we recommend enabling the following four app identity scopes. Search for each scope ID in Permissions Management.
    • View file metadata in cloud space (查看云空间中文件元数据) drive:drive.metadata:readonly lets QMind read and display the root folder name in Choose resources. Get folder metadata
    • View modern Feishu Docs (查看新版文档) docx:document:readonly lets the app read the content blocks of modern Feishu Docs.
    • View, comment on, and download all files in cloud space (查看、评论和下载云空间中所有文件) drive:drive:readonly lets the app list files and subfolders in the target folder and download original files uploaded to Drive, such as Word documents and PDFs.
    • Export cloud documents (导出云文档) drive:export:readonly lets the app export legacy Feishu Docs, standalone spreadsheets, and Bitable files. QMind also uses this scope to export modern Feishu Docs when it cannot read them directly.
    Feishu Permissions Management showing the four app identity scopes for file metadata, modern Feishu Docs, Drive files, and document export
    Optional API permissions When importing modern Feishu Docs from Feishu Wiki or Feishu Drive, enable these app identity scopes as needed for the content you want to import.
    • Embedded images and attachments. Enable Download images and attachments from cloud documents (下载云文档中的图片和附件) docs:document.media:download to download images and supported attachments. Download media
    • Embedded spreadsheets. Enable View, comment, and export spreadsheets (查看、评论和导出电子表格) sheets:spreadsheet:readonly to query worksheets and read cell values. Query worksheets · Read a single range
    • Embedded Bitable tables. Enable View, comment, and export Base (查看、评论和导出多维表格) bitable:app:readonly to read fields and records. List fields · Search records
    • Embedded whiteboards. Enable View board nodes (查看画板节点) board:whiteboard:node:read to import whiteboards as images. Download a whiteboard as an image
    • Titles of referenced documents. Looking up document titles also uses drive:drive.metadata:readonly. If you only configure Feishu Wiki, enable this scope as needed. Get file metadata
    • Names in @mentions. Enable Get basic contact information (获取通讯录基本信息) contact:contact.base:readonly and Get basic user information (获取用户基本信息) contact:user.base:readonly to look up members and read their names. The app's directory access must include the members mentioned. Get user information
    If you already enabled drive:drive:readonly, it also covers downloading embedded images and attachments and reading embedded spreadsheets.
  3. Enable the Bot capability so resource administrators can grant access through Add document app (添加文档应用). Create and publish an app version. If approval is required, wait for the app and its permissions to take effect before testing. Grant an app access to Feishu Docs · Feishu setup example
    Feishu developer console highlighting the Bot card and its Add capability button on the Add features page

Grant access to the source resources

  • Feishu Wiki. Ask a space administrator to add the Feishu app you published in the previous step as a viewer of the target wiki space.
    1. Open Wiki in Feishu Docs and select Settings on the target space card.
      Settings button on the target space card in Feishu Wiki
    2. Open Members. Under Roles and permissions, select Viewer, then select Add Member.
      Viewer role and Add Member button in the wiki space settings
    3. In the Add Viewer dialog, search for the Feishu app by name, select it, and confirm.
      Matching Feishu app in the Add Viewer dialog
    If the app does not appear in search, add it to a Feishu group chat as a bot, then add that group as a viewer of the wiki space. Feishu Wiki FAQ If a document needs a separate grant, open … → More → Add document app in that document, find the app, and give it read access. Grant an app access to Feishu Docs
  • Feishu Drive. Ask the folder owner to share the target folder with the Feishu app you published in the previous step.
    1. In Drive in Feishu Docs, right-click the target folder and select Share.
      Share option in the Feishu Drive folder menu
    2. In Invite collaborators, search for the Feishu app by name and select it. Give the app viewing access and confirm sharing.
      Matching Feishu app in the Invite collaborators dialog
    If the app does not appear in search, add it to a Feishu group chat as a bot, then share the folder with that group. Feishu folder sharing FAQ After sharing, right-click the target folder and select Copy Link. Use this link when you connect QMind. Feishu Docs resource identifiers and access
Back in QMind, choose Feishu, then select Wiki or Cloud drive as the source type. Enter a connection name, app_id, and app_secret. When creating a cloud drive data source, paste the copied Feishu folder URL into Drive folder link. Select Test connection. For Feishu Drive, QMind extracts the folder_token from the link and checks whether the app can read the folder. After the test passes, expand the target wiki space or Drive folder in Choose resources and select what to sync.

DingTalk

  1. In the DingTalk organization that owns the target knowledge base, create an internal enterprise app. In its app details, copy the Client ID (AppKey) and Client Secret (AppSecret). DingTalk Open Platform · Internal app credentials
    DingTalk developer console showing where to find the client credentials
  2. Open Permissions Management (权限管理) in the DingTalk developer console. Importing online documents from a knowledge base requires the following three permissions. Search by name and verify the permission code.
    • Read knowledge bases (知识库读权限) Wiki.Workspace.Read lists the knowledge bases the operator can access.
    • Read knowledge base nodes (知识库节点读权限) Wiki.Node.Read lists folders and documents in the knowledge base.
    • Read enterprise storage files (企业存储文件读权限) Storage.File.Read reads the content blocks of online documents. DingTalk knowledge base APIs and permissions
    To also import files uploaded to the knowledge base, such as Office documents or PDFs, enable these two permissions.
    • Read knowledge base documents (知识库文档读权限) Document.WorkspaceDocument.Read looks up the storage space and file ID of an uploaded file. Look up the file location by UUID
    • Read enterprise storage file download information (企业存储文件下载信息读权限) Storage.DownloadInfo.Read retrieves the download URL for the original file. Get file download information
    DingTalk Permissions Management showing three permissions for reading online documents and two for downloading uploaded files
    Publish the app and confirm the permissions have taken effect.
  3. Enter your own DingTalk Union ID in Operator unionId in QMind. Get the operator Union ID
  4. Back in QMind, choose DingTalk. Enter a connection name and fill in the three credential fields, then select Save and test connection. The test lists the knowledge bases the operator can access and attempts to read a document. For the first test, have an online document the operator can open so you can verify that the connection can list and read it.

Get the operator Union ID

1. Get your User ID

Method 1. Use dws

dws (DingTalk Workspace CLI) is a command-line tool for DingTalk that can look up your user information from a terminal. Follow the official guide to install it. You can also ask an enterprise administrator to look up your User ID using Method 2 below. Official dws introduction and installation guide After installation, run the following command in a terminal. Follow the prompts to open a browser, sign in with your own DingTalk account, and authorize access.
dws auth login --format json
After signing in, copy user_id directly from the result, as highlighted in the screenshot below.
The user_id field highlighted in the JSON returned after signing in with dws
If you are already signed in, you can also run the following command and copy the returned userId.
dws profile list --format json
The userId field highlighted in the account information returned by dws profile list

Method 2. Use the enterprise admin console

Ask an enterprise administrator to sign in to the DingTalk admin console, open Contacts → Member management, find your account, and copy the value in the Employee UserID (员工UserID) column.
The Employee UserID column highlighted in the DingTalk admin console member list

2. Get your Union ID

Use an app with Read member information (成员信息读权限) qyapi_get_member enabled.
  1. Open the DingTalk Query user details page and select API debugging (API 调试).
    API debugging entry on the DingTalk Query user details documentation page
  2. In the debugger, select the app you created and select Get Token (获取 Token) to populate access_token. Enter the User ID from the previous step in the request body's userid field, then select Start debugging (发起调试).
    DingTalk API debugger showing how to get a token, enter userid, run the request, and find unionid
  3. After the request succeeds, copy result.unionid from the response into Operator unionId in QMind.
Open the target document in DingTalk first. If you plan to sync attachments, also confirm you can download them. Knowledge base document operations

First import and troubleshooting

After the connection test passes, select a small document or folder in Choose resources. Select Continue, choose a sync mode, and select Import. Return to the source tree and wait for processing to finish. Then search for a sentence from the document to confirm you can find it.
What you seeWhat to check
Save and test connection fails, but the form shows Credentials configuredThe connection was saved. Select Replace credentials, enter a valid pair from the same app, and run the test again. For Feishu, use the official API testing console to check whether the app can obtain a tenant access token. For DingTalk, also check the unionId, app permissions, and whether the operator can read at least one document.
The connection test passes, but the target space, folder, or file is missingIn Feishu, confirm that the app can list the target space or folder and has access to the document. In DingTalk, confirm that the operator can open the resource and the app has permission to list the relevant nodes.
Choose resources shows a token for the Feishu Drive root folderIf QMind cannot read the folder name, it displays the folder_token. Check whether the Feishu app has drive:drive.metadata:readonly, then test the connection again after the scope takes effect.
You can select documents, but some files are missing after importCompare a readable online document with a file that failed. Check access to document content, attachment download permissions, and whether QMind supports the file type.
A document appears in the source tree, but search does not find itCheck the document's processing status and search again once processing finishes.