Create a flomo.yaml file to define your tool interface:
Copy
identity: author: yourname name: flomo label: en_US: Flomo Note zh_Hans: Flomo 浮墨笔记description: human: en_US: Add notes to your Flomo account directly from Dify. zh_Hans: 直接从Dify添加笔记到您的Flomo账户。 llm: > A tool that allows users to save notes to Flomo. Use this tool when users want to save important information from the conversation. The tool accepts a 'content' parameter that contains the text to be saved as a note.credential_schema: api_url: type: string required: true label: en_US: API URL zh_Hans: API URL human_description: en_US: Flomo API URL from your Flomo account settings. zh_Hans: 从您的Flomo账户设置中获取的API URL。tool_schema: content: type: string required: true label: en_US: Note Content zh_Hans: 笔记内容 human_description: en_US: Content to save as a note in Flomo. zh_Hans: 要保存为Flomo笔记的内容。
Create a utility module in utils/flomo_utils.py for API interaction:
Copy
import requestsdef send_flomo_note(api_url: str, content: str) -> None: """ Send a note to Flomo via the API URL. Raises requests.RequestException on network errors, and ValueError on invalid status codes or input. """ api_url = api_url.strip() if not api_url: raise ValueError("API URL is required and cannot be empty.") if not api_url.startswith('https://flomoapp.com/iwh/'): raise ValueError( "API URL should be in the format: https://flomoapp.com/iwh/{token}/{secret}/" ) if not content: raise ValueError("Content cannot be empty.") headers = {'Content-Type': 'application/json'} response = requests.post(api_url, json={"content": content}, headers=headers, timeout=10) if response.status_code != 200: raise ValueError(f"API URL is not valid. Received status code: {response.status_code}")
You can find your debug key and host in the Dify dashboard: click the “Plugins” icon in the top right corner, then click the debug icon. In the pop-up window, copy the “API Key” and “Host Address”.
2
Install dependencies and run
Copy
pip install -r requirements.txtpython -m main
Your plugin will connect to your Dify instance in debug mode.
3
Test functionality
In your Dify instance, navigate to plugins and find your debugging plugin (marked as “debugging”).
Add your Flomo API credentials and test sending a note.
You’ve built a functioning Dify plugin that connects with an external API service! This same pattern works for integrating with thousands of services - from databases and search engines to productivity tools and custom APIs.
Documentation
Write your README.md in English (en_US) describing functionality, setup, and usage examples
Localization
Create additional README files like readme/README_zh_Hans.md for other languages