Skip to content
AstrBot
Main Navigation HomeBlogRoadmapHTTP API

English

简体中文

English

简体中文

Toggle dark mode

Intro & DeployMessaging PlatformsAI IntegrationUsageDevelopment
Sidebar Navigation

Introduction

What is AstrBot

Community

FAQ

Deployment

Package Manager

Desktop Client

One-click Launcher

Docker

Kubernetes

BT Panel

1Panel

Manual

Other Deployments

CasaOS

Compshare GPU

Community-provided Deployment

Support Us

Messaging Platforms

Quick Start

QQ Official Bot

Websockets

Webhook

OneBot v11

WeCom Application

WeCom AI Bot

WeChat Official Account

Personal WeChat

Lark

DingTalk

Telegram

LINE

Slack

Mattermost

Misskey

Discord

KOOK

Satori

Connect Satori

Using server-satori

Community-provided

Matrix

VoceChat

AI Integration

✨ Model Providers

MiraRouter

NewAPI

ShengSuanYun

AIHubMix

PPIO Cloud

SiliconFlow

TokenPony

302.AI

Ollama

LMStudio

⚙️ Agent Runners

Built-in Agent Runner

Dify

Coze

Alibaba Bailian

DeerFlow

Usage

WebUI

CLI Commands

Plugins

Built-in Commands

Tool Use

Anthropic Skills

Computer Use

SubAgent Orchestration

Proactive Tasks

MCP

Web Search

Knowledge Base

Custom Rules

Agent Runner

Unified Webhook Mode

Auto Context Compression

Agent Sandbox

Development

Plugin Development

🌠 Getting Started

Minimal Example

Listen to Message Events

Send Messages

Plugin Configuration

Plugin Pages

Plugin Internationalization

AI

Storage

HTML to Image

Session Control

Publish Plugin

Plugin Market Specification

Versions

2026-06-27

Platform Adapter Integration

AstrBot HTTP API

API Scope–Endpoint Reference

AstrBot Configuration File

Others

Diagnostics

Self-hosted HTML to Image

Open Source Summer

OSPP 2025

On this page

Connect to Dify ​

Install Dify ​

If you haven't installed Dify yet, please refer to the Dify Installation Documentation to install it.

Configure Dify in AstrBot ​

In the WebUI, open Config, select the profile to edit, and open AI. Click More actions (…) beside the heading → Change Execution Mode, select Dify, read and check the reset acknowledgement, then click Use This Mode. Make sure Enable AI is on, then enter the connection settings on this page. Switching resets the current mode's configuration; see Agent Runner.

In Dify, one API Key uniquely corresponds to one Dify application. Therefore, you can configure different API keys in separate profiles to connect multiple Dify applications.

AstrBot provides these Application Type options:

  • chat
  • chatflow
  • agent
  • workflow

TIP

Please ensure that the APP type you set in AstrBot matches the application type created in Dify. image

Chat and Agent Applications ​

Create your Dify Chat and Agent application keys as shown in the figure below:

image

image

Copy the key and paste it into the API Key field in the configuration, then click Save Configuration.

Workflow Applications ​

Configure Input and Output Variable Names ​

Workflow applications receive input variables, execute the workflow, and output the results.

image

For Workflow applications, AstrBot will attach two variables with each request:

  • astrbot_text_query: Input variable name. This is the text content entered by the user.
  • astrbot_session_id: Session ID

You can customize the input variable name in the configuration, which is the Prompt Input Variable field in the Dify settings.

You need to modify the input variable name of your Workflow to adapt to AstrBot's input.

Finally, the Workflow will output a result. You can customize the variable name of this result, which is the Workflow Output Variable field in the Dify settings, with a default value of astrbot_wf_output. You need to configure this variable name in the output node of the Dify Workflow, otherwise AstrBot cannot parse it correctly.

Create API Key ​

Create your Dify Workflow application's API Key as shown in the figure below:

Click the Publish button in the upper right corner -> Access API -> click API Key in the upper right corner -> Create Key, then copy the API Key.

image

Copy the key and paste it into the API Key field in the configuration, then click Save Configuration.

Save the Configuration ​

When all fields are complete, click Save Configuration at the bottom right. This profile uses the selected execution mode and connection settings directly; no separate runner provider or provider ID selection is needed.

Appendix: Dynamically Set Workflow Input Variables During Chat (Optional) ​

You can use the /set command to dynamically set input variables, as shown in the figure below:

alt text

After setting variables, AstrBot will attach the variables you set in the next request to Dify, flexibly adapting to your Workflow.

alt text

Of course, you can use the /unset command to cancel the variables you set.

Variables are permanently valid in the current session.

Edit this page on GitHub

Last updated:

Pager
PreviousBuilt-in Agent Runner
NextCoze

Deployed on Rainyun Logo