Dify Workflow Detailed Steps Explained - From Beginner to Master!

We briefly introduced Dify workflows and the efficiency improvements they can bring. Many friends are very interested in how to build Dify workflows, so today we'll explain in detail how to create a Dify workflow from scratch.
I. Preparation
Before starting to build a workflow, we need to understand the basic concepts and operations of the Dify platform.
- Nodes: Nodes are the basic units that make up a workflow. Each node represents a specific operation, such as receiving user input, calling a large language model, processing data, etc.
- Connection Lines: Connection lines connect different nodes, defining the execution order of the workflow.
- Variables: Variables store data and can be passed between different nodes.
II. Creating a Workflow
Log into the Dify platform, click "Create Blank Application," then select "Workflow." Give your workflow a name, such as "Xiaohongshu Viral Content Creation Workflow."
III. Adding Nodes
Dify provides a rich variety of node types to meet various needs. Taking the Xiaohongshu viral content creation workflow as an example, add the following nodes:
-
Start Node: Every workflow must have a start node to receive user input parameters. On the start node's settings page, we can add four input fields: Source, Style, Number of Titles, and Content Length.
- Source: Can be a topic or a news link.
- Style: Such as cute style, professional style, etc.
- Number of Titles: For example, 3 titles.
- Content Length: For example, around 100 characters.
-
Question Classifier Node: Used to determine whether the source field is a URL link or a topic/keyword.
- Input Variable: Source
- Model: Can choose GPT-3.5
- Question Classification: Determine if it's a URL link or topic/keyword
-
Custom Tool Node: If it's a URL link, use this node to fetch webpage content. You can create custom tools through the tools menu.
-
Content Outline Generator Node: If it's a topic, use this node to generate a content outline.
- Model: Can choose GPT-3.5
- Task Requirements:
- System Prompt: You are a Xiaohongshu viral writing expert. Write Xiaohongshu content based on user-given topics, with content length requirement of about 100 characters.
- Role Prompt: Topic as follows:\nStart/{x}content
-
Variable Assignment Node: Convert results from the previous two processes into a unified variable for later processes to call.
- Variable Type: Choose appropriate variable type
- Variable Value: Corresponds to output values from the two nodes in previous steps
-
Title Creation Node: Used to create viral Xiaohongshu titles based on output from previous nodes.
- Model: Can choose GPT-3.5
- Task Requirements:
- System Prompt: You are a Xiaohongshu viral writing expert. Write {x} viral titles (with appropriate emojis).\nI. For Xiaohongshu titles, you master the following skills:\n1. Use two-level title method for creation.\n2. You're good at using title characteristics that attract people.\n3. You use viral keywords. When writing titles, randomly select 1-2 from this list.\n4. You understand Xiaohongshu platform's title characteristics.\n5. You know creation rules.\nII. Combine the information I give you and the title techniques you've mastered to write titles; Output format:\n1. Title One;
- Role Prompt:\nThis is the content:\nStart/{x}output
-
Content Writing Node: Used to write Xiaohongshu content.
- Model: Recommend GPT-4
- Task Requirements:
- System Prompt: You are a Xiaohongshu viral writing expert. Write Xiaohongshu viral content based on user-given content (each paragraph contains appropriate emoji expressions, with suitable tag labels at the end).\nI. For Xiaohongshu content, you master the following skills:\n1. Writing style\n2. Writing opening methods\n3. Text structure\n4. Interaction guidance methods\n5. Some小技巧\n6. Viral words\n7. Extract 3-6 SEO keywords from your generated content, generate #tags and place at the end of the article\n8. Make every sentence in the article as colloquial and short as possible\n9. Use emojis at the beginning of each paragraph, at the end of each paragraph, and insert emojis in the middle of each paragraph.\nII. Combine the reference titles and content I give you, and the content techniques you've mastered, write Xiaohongshu content according to {x}style content style (content length: about {X}length characters);
- Role Prompt:\nReference titles:\n{x}text\nContent:\n{x}output
-
Content Formatting Node: Used to handle formatting issues, such as adding line breaks, etc. You can use code execution nodes to write simple Python or JavaScript code.
-
Upload Content Node: Used to upload generated titles and content to your target platform, such as Notion notes. You can use HTTP-type nodes to send requests.
-
Template Conversion Node: Merge the previously generated Xiaohongshu titles and content together for final output.
IV. Connecting Nodes
Connect all nodes with connection lines in logical order.
V. Testing and Publishing
Click the "Run" button in the upper right corner to test if your workflow runs properly. If everything works correctly, click the "Publish" button to let others use your workflow.
Dify Workflow Usage Tips
- Reasonably Split Tasks: Breaking complex tasks into multiple smaller tasks can improve AI model processing efficiency and make workflows easier to understand and maintain.
- Use Variables Cleverly: Using variables to store and pass data can make workflows more flexible.
- Fully Utilize System Variables: Dify provides many system variables, such as user ID, application ID, etc., which can be used to record and analyze workflow operation.
- Make Good Use of External Tools and APIs: Dify can connect to various external tools and APIs, such as search engines, image generation tools, etc., which can greatly expand workflow functionality.
Summary
Dify workflow is a very powerful automation tool that can help us delegate many repetitive tasks to AI, giving us more time to do more creative things. Hope this blog can help you quickly get started with Dify workflow and create your own automation processes!