Build AI Workflow

Step 1 Build AI Workflow

Create a workflow type application in the Dify console

Create workflow

First, define the start node. Click + in the pop-up options box, and enter the variable content as the input source.

Input text

Similarly, add three variables: style, titlenum, and length.Among them, the input field types for content and style are Short text, while titlenum and length are Number.

Input text

Input text

Click the + on the right side of the start node box to add a question classifier node. Select content as the input variable, choose an appropriate LLM model, and set the classification options to url and topic/keyword.

Question claffier

Add a web scraper node for the first classification.

Add web scraper

Select content for the variable content.

Add content

Add an LLM type node for the second classification, with the title "Generate Outline". The SYSTEM prompt is:

You are an expert in writing popular content for Xiaohongshu. 
Based on the given topic, write Xiaohongshu content with around 100 words.

Select the content variable for the USER prompt.

Add LLM

Click the + on the right side of the web scraper node to add a variable aggregator node. Select web scraper/text for variable assignment.

Add aggregator

Click the + on the right side of the LLM node, drag the line to connect it to the variable aggregator node, and select LLM/text for assignment in the pop-up options box.

Aggregator

Add an LLM node for title generation. The SYSTEM prompt is:

You are an expert in writing popular content for Xiaohongshu. Based on the user's content, write <replace with titlenum variable> popular titles (including appropriate emoji).

First, In terms of Xiaohongshu titles, you have the following skills:
1. You use the diode title method for creation.
2. You are good at using attractive features in titles.
3. You use popular keywords and randomly select 1-2 from this list when writing titles.
4. You understand the characteristics of titles on the Xiaohongshu platform.
5. You know the rules of creation.

Second, Combine the input information I provide and your title skills to write the titles; output format:
1. Title one; 
...

Select the output variable for the USER prompt.

LLM title generate

Add an LLM node for copywriting generation. The SYSTEM prompt is:

You are an expert in writing popular content for Xiaohongshu. Based on the user's content, write Xiaohongshu popular copy (each paragraph contains appropriate emoji, and there are suitable tag labels at the end of the text).

In terms of Xiaohongshu copywriting, you have the following skills:

Writing style
Opening methods
Text structure
Interaction guidance methods
Some small tips
Explosive words
Extract 3-6 SEO keywords from your generated draft and generate #tags to place at the end of the article
Make each sentence as colloquial and short as possible
Use emojis at the beginning, middle, and end of each paragraph
Combine the reference titles and content I provide, and your copywriting skills, to write Xiaohongshu copy in the <replace with style variable> style (copy length: around <replace with length variable> words).

USER prompt 1

Reference title: <LLM-title text variable> 

Content: <variable aggregator output variable>

LLM content generate

Add a template conversion node to integrate the title and content.

Title content integrate

Add an end node and define result as the output variable of the template conversion.

End setting

The complete workflow is as follows:

total pipeline

STEP 2. Testing and Validation

Click the Run button in the upper right corner to test: Enter text.

Text input Text output

input url

url input url output

Now, an AI workflow for copywriting generation has been successfully built.