What You’ll Build
By the end of this guide, you’ll have created a Dify plugin that:- Connects to the Flomo note-taking API
- Allows users to save notes from AI conversations directly to Flomo
- Handles authentication and error states properly
- Is ready for distribution in the Dify Marketplace
Time required
10 minutes
Prerequisites
Basic Python knowledge and a Flomo account
Step 1: Install the Dify Plugin CLI and Create a Project
Initialize a plugin project
Create a new plugin project using:Follow the prompts to set up your plugin:
- Name it
flomo - Select
toolas the plugin type - Complete the other required fields
Step 2: Define Your Plugin Manifest
The
manifest.yaml file defines your plugin’s metadata, permissions, and capabilities.manifest.yaml file:
Step 3: Create the Tool Definition
A tool plugin uses two YAML files: a provider file that declares credentials and lists the tools, and one tool file per callable tool. See General Specifications for the full schema. Createprovider/flomo.yaml:
tools/flomo.yaml:
Step 4: Implement Core Utility Functions
Create a utility module inutils/flomo_utils.py for API interaction:
Step 5: Implement the Tool Provider
The Tool Provider handles credential validation. Createprovider/flomo.py:
Step 6: Implement the Tool
The Tool class handles actual API calls when the user invokes the plugin. Createtools/flomo.py:
Step 7: Test Your Plugin
Set up debug environment
Copy the example environment file:Edit the You can find your debug URL and key in the Dify dashboard: click the Plugins icon in the top-right corner, then click the debug icon. Copy the API Key and Host Address (the host already includes the port).
.env file with your Dify environment details:Step 8: Package and Distribute
When you’re ready to share your plugin:plugin.difypkg file you can upload to the Dify Marketplace.
FAQ and Troubleshooting
Plugin doesn't appear in debug mode
Plugin doesn't appear in debug mode
Make sure your
.env file is properly configured and you’re using the correct debug key.API authentication errors
API authentication errors
Double-check your Flomo API URL format. It should be in the form:
https://flomoapp.com/iwh/{token}/{secret}/Packaging fails
Packaging fails
Ensure all required files are present and the
manifest.yaml structure is valid.Summary
You’ve built a functioning Dify plugin that connects with an external API service. The 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 examplesLocalization
Create additional README files like
readme/README_zh_Hans.md for other languages