Connect a DingTalk data source
AI-Native Database Service allows you to connect DingTalk as a data source for RAGFlow knowledge bases. You can synchronize files from DingTalk Drive or documents from DingTalk Knowledge Base to RAGFlow to build enterprise-grade intelligent Q&A and knowledge retrieval services.
Supported data types
|
Data type |
Description |
|
DingTalk Drive files |
Files stored in DingTalk Drive, including files in PDF, Word, Excel, and PowerPoint formats. |
|
DingTalk Knowledge Base documents |
Online documents stored in DingTalk Knowledge Base. To synchronize these documents, you must export them by using the KBSync tool in a Linux environment. |
Prerequisites
-
A RAGFlow instance is created in the AI-Native Database Service console.
-
An internal enterprise application is created on the DingTalk Open Platform, and the Client ID (AppKey) and Client Secret (AppSecret) of the application are obtained.
-
To synchronize DingTalk Knowledge Base documents, the machine that runs KBSync must meet the following requirements:
-
The operating system is Linux.
-
Chrome is installed for document rendering and export.
-
Step 1: Configure application permissions
Log on to the DingTalk Open Platform. Go to the internal enterprise application that you created and add the following permissions on the Permission Management page.
|
Permission |
Permission code |
Purpose |
|
Read access to contact personal information |
Contact.User.Read |
Obtain employee UserIDs |
|
Read access to contact department information |
Contact.Department.Read |
Read department information |
|
Read-only access to Drive files |
Drive.File.Read |
Read Drive file content |
|
Read-only access to Drive space information |
Drive.Spaces.Read |
Retrieve the list of Drive spaces |
|
Read-only access to Knowledge Base documents |
Wiki.Doc.Read |
Read Knowledge Base documents |
|
Read-only access to Knowledge Base spaces |
Wiki.Space.Read |
Retrieve the list of Knowledge Base spaces |
After you add the permissions, authorize the application in the DingTalk Admin Console to grant the application access to enterprise data.
Step 2: Obtain the employee UserID
Obtain the UserID of the employee whose data you want to synchronize. You can use one of the following methods:
-
In the DingTalk Admin Console, go to Contacts, view the employee details, and find the UserID.
-
Call the
/topapi/v2/user/getbymobileAPI on the DingTalk Open Platform to query the UserID by mobile number.
Step 3: Configure the data source and synchronize data
Log on to the AI-Native Database Service console. In the left-side navigation pane, choose AI Data Preparation > Multimodal Data Preparation. Click the target RAGFlow instance to go to its details page, and then configure the DingTalk data source.
Synchronize DingTalk Drive files
Specify the following parameters in the data source configuration:
|
Parameter |
Description |
|
sourceType |
Set this parameter to |
|
Client ID |
The AppKey of the DingTalk application. |
|
Client Secret |
The AppSecret of the DingTalk application. |
|
UserID |
The employee UserID obtained in Step 2. |
Synchronize DingTalk Knowledge Base documents
DingTalk Knowledge Base documents must be synchronized by using the KBSync tool. Perform the following steps:
-
Install Chrome and the KBSync tool in a Linux environment.
-
Configure the KBSync tool parameters, including Client ID, Client Secret, and the target employee UserID.
-
Run the KBSync tool. The tool automatically exports documents from the DingTalk Knowledge Base and synchronizes them to the RAGFlow knowledge base.
The KBSync tool relies on Chrome for document rendering. Make sure that Chrome is installed in the runtime environment. If you use headless mode, verify that your Chrome version supports the --headless=new parameter.
Result
After the data source is configured and data synchronization is complete, files and documents from DingTalk appear in the RAGFlow knowledge base. To view the synchronization status and the list of imported documents, log on to the AI-Native Database Service console, and then choose AI Data Preparation > Multimodal Data Preparation. Click the target instance to view details.