Skip to content

Integrate OpenClaw AI agent with Dify AI workflow platform. One-command deployment with Docker Compose. Comprehensive English & Chinese documentation.

License

Notifications You must be signed in to change notification settings

gaoios/openclaw-dify-starter

Repository files navigation

OpenClaw + Dify Starter

๐Ÿš€ Integrate OpenClaw AI agent with Dify AI workflow platform

License: MIT OpenClaw Dify

English | ไธญๆ–‡ๆ–‡ๆกฃ

๐ŸŒŸ What is This?

This project enables seamless integration between OpenClaw (Telegram AI agent) and Dify (AI application development platform), allowing you to:

  • ๐Ÿ“ฑ Chat with Dify AI workflows via Telegram
  • ๐Ÿค– Build powerful AI agents with visual workflow editor
  • ๐Ÿ”— Connect multiple AI models and services
  • ๐Ÿ“š Create knowledge bases for Q&A systems
  • ๐ŸŽจ Design custom AI applications without coding

Inspired by openclaw-n8n-starter, this project replaces n8n with Dify for AI-first workflow automation.

โœจ Features

Core Components

  • OpenClaw - AI agent accessible via Telegram
  • Dify - Visual AI workflow builder
    • Chat applications
    • Text completion
    • Workflow orchestration
    • Knowledge base integration
    • Multi-model support (OpenAI, Claude, local LLMs)
  • Caddy - Automatic HTTPS reverse proxy
  • PostgreSQL - Data persistence
  • Redis - Caching and task queue

Security Features

  • ๐Ÿ”’ Three-tier network isolation (frontend/backend/egress)
  • ๐Ÿ”’ OpenClaw not exposed to internet
  • ๐Ÿ”’ API key authentication
  • ๐Ÿ”’ Automatic HTTPS certificates
  • ๐Ÿ”’ Container security hardening

๐Ÿš€ Quick Start

Prerequisites

One-Command Deployment

# SSH into your server
ssh root@your-server

# Download and run setup script
curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/openclaw-dify-starter/main/setup.sh | bash

The script will:

  1. โœ… Install Docker and Docker Compose
  2. โœ… Configure firewall (ufw)
  3. โœ… Build OpenClaw from source
  4. โœ… Generate secure random keys
  5. โœ… Set up Caddy for HTTPS
  6. โœ… Start all services

Manual Deployment

# Clone the repository
git clone https://github.com/YOUR_USERNAME/openclaw-dify-starter.git
cd openclaw-dify-starter

# Run setup script
chmod +x setup.sh
./setup.sh

๐Ÿ—๏ธ Architecture

Internet
    โ”‚
    โ”œโ”€โ”€โ”€ Telegram โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ OpenClaw (internal only)
    โ”‚                              โ”‚
    โ”‚                              โ–ผ
    โ””โ”€โ”€โ”€ HTTPS โ”€โ”€โ–บ Caddy โ”€โ”€โ–บ Dify โ—„โ”€โ”˜
                              โ”‚
                              โ–ผ
                    PostgreSQL + Redis (internal)

Network Isolation

  • Frontend Network: Public-facing services (Caddy, Dify Web)
  • Backend Network: Internal services (PostgreSQL, Redis)
  • Egress Network: Outbound connections only

๐Ÿ“š Documentation

English

ไธญๆ–‡ๆ–‡ๆกฃ (Chinese)

๐ŸŽฏ Use Cases

1. Personal Knowledge Assistant

  • Upload documents to Dify knowledge base
  • Query via Telegram through OpenClaw
  • Get AI-powered intelligent answers

2. Enterprise Document Q&A

  • Build company knowledge base
  • Employees query through Telegram
  • 24/7 automated support

3. Multi-Model Experimentation

  • Configure multiple AI models
  • Compare responses
  • Optimize prompts and workflows

4. AI Content Generation

  • Text summarization
  • Translation
  • Creative writing
  • Code generation

๐Ÿ’ก Example Workflows

We provide 7 ready-to-use examples (view in Chinese):

  1. ๐Ÿ“ฐ Daily News Summary Bot
  2. ๐Ÿ“š Intelligent Document Q&A
  3. ๐ŸŒ Multi-language Translation
  4. ๐Ÿ’ป Code Review Assistant
  5. ๐Ÿ“ Personal Diary Analyzer
  6. ๐Ÿ“ก RSS Monitor & Notifier
  7. ๐Ÿ“‹ Meeting Notes Summarizer

๐Ÿ”ง Configuration

Environment Variables

See .env.example for all configuration options:

# Required
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_USER_ID=your_telegram_user_id
OPENAI_API_KEY=your_openai_api_key

# Auto-generated during setup
OPENCLAW_GATEWAY_TOKEN=auto_generated
DIFY_SECRET_KEY=auto_generated
POSTGRES_PASSWORD=auto_generated

Access URLs

After deployment (replace 123.45.67.89 with your server IP):

  • Dify Web UI: https://123.45.67.89.nip.io
  • OpenClaw Gateway: Internal only (port 18789)
  • Telegram Bot: Search for your bot in Telegram

๐Ÿ“Š Comparison with n8n Version

Feature n8n-starter dify-starter
Focus General automation AI applications
AI Capabilities Via integration Built-in
Knowledge Base Plugin required Native support
Learning Curve Medium Lower
RAM Required 2GB 4GB
Best For Integrations AI agents

See ๅฏนๆฏ”่ฏดๆ˜Ž.md for detailed comparison.

๐Ÿ› ๏ธ Skills

OpenClaw skills for Dify integration (in skills/ directory):

  • dify-api - General Dify API integration (Docker internal network)
  • dify-api/SKILL_ไบ‘็ซฏ็‰ˆ.md - Cloud Dify setup guide
  • dify-cloud-ready - Ready-to-use cloud configuration

Each skill includes:

  • Complete API documentation
  • Usage examples
  • Error handling
  • Best practices

๐Ÿ” Troubleshooting

Common Issues

  1. "Workflow not published"

    • Publish your application in Dify Web UI first
  2. Port conflicts

    • Stop conflicting services: docker compose down
  3. Skill not found

    • Ensure skill is in correct OpenClaw workspace path
  4. API errors

    • Check API key is correct
    • Verify application is published
    • Check logs: docker compose logs -f dify-api

๐Ÿ“ˆ Monitoring

# View all logs
docker compose logs -f

# View specific service
docker compose logs -f dify-api
docker compose logs -f openclaw-gateway

# Check service status
docker compose ps

# Resource usage
docker stats

๐Ÿค Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Areas we need help:

  • ๐Ÿ“ Documentation improvements
  • ๐Ÿ”ง New workflow examples
  • ๐ŸŒ Translations
  • ๐Ÿ› Bug reports and fixes
  • โœจ Feature requests

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Credits

๐Ÿ’ฌ Community

โญ Star History

If you find this project helpful, please give it a star! It helps others discover the project.


Built with โค๏ธ for the OpenClaw and Dify communities

About

Integrate OpenClaw AI agent with Dify AI workflow platform. One-command deployment with Docker Compose. Comprehensive English & Chinese documentation.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages