Building Efficient Workflows with Dify AI to Save Time and Costs

Dify AI is a powerful AI workflow platform that allows you to quickly and easily integrate various tools and services, automating repetitive tasks. Whether it’s data analysis, content generation, or customer service, Dify AI can help you improve work efficiency. With an intuitive interface and drag-and-drop operations, you can easily create your own smart workflows.

Introduction

Dify AI provides an intuitive workflow design interface, combined with API integration capabilities, allowing you to quickly integrate complex operational processes into LINE chatbots, meeting various application scenarios.

Building Efficient Workflows with Dify AI to Save Time and Costs


Step 1: Register and Choose a Workflow Template

First, go to Dify to register an account and choose the built-in SEO Blog Generator. This step is optional; you can create your own.

Dify Workflow SEO Template

Before publishing the workflow, make sure all nodes are fully set up.

Workflow Checklist


Step 2: Configure Key Parameters

Node Setup

Start Node Setup

  • Keyword: Search keyword
  • Title: Article title
  • Audience: Target readers
  • Brands to avoid: Brands to avoid mentioning
  • Tone: Tone style

End Node Setup

  • Output: Final output content

Node Parameter Setup


Step 3: Run and Set Up API Key

After clicking publish, you can immediately run the workflow to test the output content. Publish Workflow

Create API Key

Go to Workflow App API to generate an API key for integration. Create API Key

Example settings:

  • URL: https://api.dify.ai/v1/workflows/run
  • Method: POST
  • Header: Authorization: Bearer {API_KEY}
  • Payload:
    {
      "inputs": {
        "keyword": "SEO marketing",
        "title": "SEO Marketing Strategy Guide for Beginners",
        "audience": "Startup owners",
        "brands_to_avoid": "Google, Bing",
        "tone": "Professional but easy to understand"
      },
      "response_mode": "blocking",
      "user": "{unique_user_id}"
    }
    

    Response (focus on the output parameter within outputs),

    {
      "workflow_run_id": "djflajgkldjgd",
      "task_id": "9da23599-e713-473b-982c-4328d4f5c78a",
      "data": {
          "id": "fdlsjfjejkghjda",
          "workflow_id": "fldjaslkfjlsda",
          "status": "succeeded",
          "outputs": {
            "output": "{output}"
          },
          "error": null,
          "elapsed_time": 0.875,
          "total_tokens": 3562,
          "total_steps": 8,
          "created_at": 1705407629,
          "finished_at": 1727807631
      }
    }
    

Step 4: Set Up Resources in dmflow

In the dmflow.chat platform, set up resource nodes and corresponding variables to achieve seamless integration with LINE chatbots.

Variable Node Setup

Add the following seven key variables:

  • user_id: User’s ID.
  • title: Title.
  • keyword: Keyword.
  • tone: Tone.
  • audience: Target audience.
  • brands_to_avoid: Brands to avoid.
  • output: Final workflow output content.

Refer to the image on the right for resource setup.

Resource Node Design


Step 5: Create an Article Form

Create Article Form

Select the input variables created above:

  • user_id
  • title
  • keyword
  • tone
  • audience
  • brands_to_avoid

And add the output variable:

  • output

Create Form Fields

Step 6: Create a Trigger

Create Trigger and Background

Set up the background resource node and update the form.

Left is Resource Node, Right is Update Form

Step 7: Generate Articles

First, set up the new page to adjust, making sure to remove the output field and add the button’s trigger ID.

Dashboard New Page Adjustment

Finally, generate articles in three steps:

  1. Click on the new list, enter the title, keyword, tone, audience, and brands_to_avoid you want to generate. The userId is currently only returned to Dify because the new list automatically binds the creator.
  2. When you are the owner, wait for the refresh prompt to appear. The list on the right will turn red when refreshed. Click to refresh the selected list.
  3. Generate the article.

Generate Article

Conclusion

Share on:
Previous: Complete Guide to Integrating Dify AI with LINE Chatbot
Next: Connect LINE Chatbots: Seamless Scenario Switching