Dify Integration
Overview
Dify is an open-source large language model (LLM) application development platform. It integrates the concepts of Backend as Service and LLMOps, enabling developers to quickly build production-grade generative AI applications.
The serviceme-rag-dify plugin provided by SERVICEME brings SERVICEME's powerful enterprise-level Retrieval-Augmented Generation (RAG) capabilities as a tool to Dify workflows and applications, helping users securely access enterprise knowledge bases and perform contextual retrieval and Q&A within Dify.
Main capabilities include:
- Perform hybrid, vector, or keyword search on SERVICEME workspaces.
- Return structured answers, metadata, and workspace context for further processing in subsequent nodes.
- Support setting workspace scope, similarity threshold, hybrid weights, and reranker models to match enterprise governance policies.
- Automatically manage OAuth token status to ensure the tool remains callable after token refresh.
Minimum Version & Prerequisites
- Minimum supported version: Dify ≥ 1.9.0.
- Accessible SERVICEME environment with OpenAPI permissions enabled.
- OAuth2 credentials (
client_id,client_secret, user account) created according to the SERVICEME OpenAPI Authentication Guide. - Dify workspace permissions to import and configure custom plugins.
Plugin Installation
Install via Marketplace
-
In the top right corner of the Dify console, click Plugins > Install plugin > Marketplace.
-
Enter
SERVICEME RAGin the search box and press Enter.
-
Hover over the first result (SERVICEME RAG), and click Install.
-
After installation, a success prompt will pop up, and the plugin will automatically appear in the Plugins list.

Install via GitHub
-
In the top right corner of the Dify console, click Plugins > Install plugin > GitHub.

-
Enter the
serviceme-rag-difyrepository address:https://github.com/medalsoftchina/serviceme-rag-difyand click Next.
-
Select the corresponding version and plugin file, then click Next.

-
After installation, confirm the plugin appears in the Plugins list.

Install via Local difypkg
-
Visit the Release page of the GitHub repository and download the latest
serviceme-rag-dify.difypkg. -
In the Dify console, select Plugins > Install plugin > Local Package Plugin, and upload the downloaded installation package.
-
After completion, confirm the installation success prompt appears.

The functionalities of both installation methods are identical. Choose the appropriate method based on your deployment environment's network policy.
Configure OAuth2 Authentication
The SERVICEME plugin uses OAuth2 to access SERVICEME OpenAPI resources. Please configure as follows:
-
In the SERVICEME admin panel, enter the super admin interface. The system administrator creates credentials via the client management interface
{domain}#/super-admin/client-management, generatingclient_idandclient_secret.
-
In the Dify console, click the plugin, then click Use OAuth Authorization in the sidebar.

-
In Vendor Configuration, fill in the relevant SERVICEME environment information and click Save and Authorize:
- Base URL: SERVICEME domain (including protocol), e.g.,
https://example.serviceme.com. - Client Id / Client Secret: Credentials from the client management interface.
- Account: SERVICEME username used to call OpenAPI.

- Base URL: SERVICEME domain (including protocol), e.g.,
-
After saving, if everything is correct, a green verification will be displayed. The plugin will call
/openapi/auth/client_with_accountto obtain the access token and automatically refresh it when expired.
To simplify authorization control, the OAuth authorization scope is controlled by the data visibility range of the SERVICEME user role. Refer to the OpenAPI section for details.
Using the SERVICEME RAG Tool in Dify
-
Go to Dify's Studio, create a Chatflow workflow, and name it Test SERVICEME.

-
On the canvas, click Add Node > Tools > serviceme-rag.

-
After filling in
Query Stringand/orKeywords, the node can be executed.
-
Run a debug conversation to verify whether the tool returns the expected results.
Parameter Description
After adding the serviceme-rag tool to a node, you can adjust retrieval behavior with the following parameters:
| Input Item | Description |
|---|---|
query | Optional, natural language query. If not entered, can be used with keywords. |
keywords | Optional, keywords separated by |. |
workspaces | Optional, array of SERVICEME workspace IDs to limit the search scope. |
top_k | Required, number of results to return. |
rag_object | Required, retrieval object: both, qna, or doc. |
rag_mode | Required, retrieval mode: hybrid, embedding, or fulltext. |
min_similarity | Optional, similarity threshold, range 0~1, default 0.8. |
metadata_filter | Optional, metadata filter, currently supports default. |
weights | Optional, JSON for configuring RRF weights for hybrid retrieval. |
reranker | Optional, specify reranker model name. Leave blank to disable reranking. Note: If your SERVICEME environment does not enable reranker models, be sure to leave this blank |
Best Practices
- Create separate OAuth2 clients and scopes for different business scenarios to reduce the risk of excessive permissions.
- Use Dify's version management feature to validate plugin configuration in a sandbox environment before releasing to production.
- Regularly check plugin logs to promptly detect invocation exceptions.
Troubleshooting
- Authentication Failure
- Confirm whether
client_idandclient_secretare correct. - Check if the account providing the scope has the correct role set in the corresponding SERVICEME environment.
- Ensure the Dify server can access the SERVICEME address.
- Confirm whether
- No Data Returned from Tool Invocation
- Check whether the bound data source has completed synchronization.
- Adjust retrieval parameters (such as similarity threshold, recall count).
- Verify whether the calling account is authorized to access the target data.
- Plugin Installation Exception
- Check the Dify plugin logs for error messages.
- If using local installation, ensure the difypkg file is complete and compatible with the Dify version.
- Re-download the latest version package and try again.
- Third-party Signature
- If the Dify server is self-hosted and requires third-party plugin signatures, please contact the corresponding Medalsoft (SoftwareOne subsidiary) representative to obtain the public key file for the signature.