Dify - Create New Workflow

Site: dify|https://dify.ai/

Get plain text:

curl -H "Accept: text/plain" https://jugoya.ai/guides/dify/create-workflow

Overview

Create a new workflow application in Dify from scratch, configure start node, and set up basic workflow structure.

Access Studio

  1. Navigate to Dify instance (e.g., http://{DIFY_HOST}/apps)
  2. You should see the Studio page with your existing apps

Create New App

UI Elements

  • button "Create from Blank" - Start empty app
  • button "Create from Template" - Use pre-built template
  • button "Import DSL file" - Import workflow definition

Steps

  1. Click "Create from Blank"
  2. Dialog appears: "Choose an App Type"

App Types

TypeDescriptionUse Case
WorkflowOne-shot execution, API-callableData processing, automation
ChatflowMulti-turn conversation with memoryChatbots, interactive assistants
ChatbotSimple chat interfaceBasic Q&A
AgentAutonomous tool-using agentComplex reasoning tasks
CompletionText completionSimple generation
  1. Click "Workflow" or "Chatflow" based on your needs
  2. Enter "App Name & Icon":
    • input "Give your app a name" - Required
    • input "Enter the description of the app" - Optional
    • Emoji icon selector (default: robot emoji)
  3. Click "Create" button

Select Start Node

After creation, dialog appears: "Select a start node to begin"

Start Node Options

  1. User Input (original start node)

    • Allows setting user input variables
    • Supports: web app, service API, MCP server, workflow as tool
    • Best for: API integration, web interface
  2. Trigger

    • Scheduled tasks
    • Custom webhooks
    • Integrations with other apps
    • Best for: Automation, scheduled jobs

Click the appropriate start node option.

Workflow Editor

After selecting start node, editor opens with:

  • Canvas area for building workflow
  • Top bar: App name, tabs (Orchestrate, API Access, Logs, Monitoring)
  • Right panel: Node configuration
  • Bottom bar: Auto-save status, "Test Run" button, "Publish" button

Editor Tabs

  • Orchestrate - Visual workflow editor (default)
  • API Access - Get API keys and endpoints
  • Logs - View execution history
  • Monitoring - Performance metrics

Adding Nodes

Right-click on canvas or drag from node palette to add:

  • LLM nodes (GPT, Claude, Gemini, etc.)
  • Code execution nodes
  • HTTP request nodes
  • Conditional branches
  • Iteration nodes

Publish Workflow

  1. Configure all nodes
  2. Click "Test Run" (shortcut: ⌥R) to verify
  3. Click "Publish" button to deploy
  4. Status changes from "Unpublished" to "Published X ago"

Get API Access

  1. Click "API Access" tab
  2. Find "API Key" section
  3. Click "Create" to generate new key (format: app-xxxxxxxx)
  4. Copy the API endpoint URL
  5. Use in your application:
curl -X POST '{DIFY_HOST}/v1/workflows/run' \
  -H 'Authorization: Bearer {API_KEY}' \
  -H 'Content-Type: application/json' \
  -d '{"inputs": {"query": "Hello"}, "response_mode": "blocking", "user": "user-id"}'

Tips

  • Workflow apps execute once per API call (stateless)
  • Chatflow apps maintain conversation context
  • Use "Test Run" frequently during development
  • Check "Logs" tab for debugging failed executions
  • Published workflows can be updated without changing API endpoint