DifyAI icon

DifyAI

Consume Dify API

Overview

This node integrates with the Dify API to perform AI-powered operations, primarily focused on chat interactions and file processing. The "Send Chat Message" operation allows users to send a message to an AI chat service, optionally continuing an existing conversation or including files as context. This is useful for building conversational AI workflows, customer support bots, or interactive assistants that can handle multimedia inputs.

Practical examples:

  • Sending a user query to an AI chatbot and receiving a response.
  • Continuing a previous conversation by providing a conversation ID.
  • Attaching images, documents, or audio files to enrich the chat context.

Properties

Name Meaning
User ID Unique identifier for the user sending the chat message.
Query The content of the user's input or question to the AI chat service.
Conversation ID Identifier to continue an existing conversation thread with the AI.
Response Mode Mode of response from the API: either "Streaming" (real-time partial responses) or "Blocking" (wait for full response).
Files Collection of files to attach to the chat message. Each file includes:
- Type File type category: Audio, Custom, Document, Image, Video.
- Transfer Method How the file is provided: Remote URL or Local File (uploaded previously).
- URL URL of the file if using remote transfer method.
- Upload File ID Identifier of the uploaded file if using local file transfer method.

Output

The node outputs JSON data representing the response from the Dify API for the chat message request. This typically includes the AI-generated reply, conversation metadata, and any additional information returned by the API.

If files are involved, the output may reflect how those files were processed or referenced in the chat context.

No binary output is produced for this operation.

Dependencies

  • Requires an API key credential for authenticating with the Dify API.
  • The base URL for the API is configured via credentials and normalized to use HTTPS and the /v1 path.
  • Network access to the Dify API endpoint is necessary.

Troubleshooting

  • Missing binary data error: If using other operations (not relevant here), errors like No binary data property "X" on item! indicate that the expected binary input was not found. For "Send Chat Message", ensure all required string parameters are set.
  • API authentication failures: Ensure the API key credential is valid and has proper permissions.
  • Invalid conversation ID: Providing an incorrect or expired conversation ID may cause the API to reject the continuation request.
  • File attachment issues: When attaching files, verify that URLs are accessible or that uploaded file IDs are correct and available in n8n.
  • Response mode confusion: Selecting "Streaming" requires handling partial responses; if your workflow expects complete replies, use "Blocking".

Links and References

Discussion