| title | Dify integration |
|---|---|
| description | Connect Apify with Dify to automate workflows by running Actors, extracting data, and responding to Apify events. |
| sidebar_label | Dify |
| sidebar_position | 7 |
| slug | /integrations/dify |
Connect Apify with Dify to automate workflows by running Actors, extracting structured data, and responding to Actor or task events.
Dify is an intuitive LLM application development platform for creating and operating AI-native apps. With the Apify integration for Dify, you can connect Apify Actors and storage to your Dify Workflows and Chatflows. You can run scrapers, extract data, and trigger workflows based on Apify events.
In this guide, you'll learn how to set up authentication and incorporate the Apify plugin into your Dify applications as either a tool (action) or a trigger.
Before you begin, make sure you have:
- An Apify account
- A Dify account (self‑hosted or cloud)
To connect your Apify account, you need to configure the plugin with your Apify API token.
- In Dify, navigate to Plugins from the top menu.
- Click on the Install plugin → Marketplace
- Find the apify-integration plugin and install it.
- Return back to the Plugins page. There will be our plugin.
- Open the plugin window and click on the Add API Key.
- In the pop-up menu, paste your Apify API token. You can find it in the Apify Console.
- Click Save.
A green indicator light confirms that your credentials are correct.
With authentication set up, you can now add Apify tools to your applications.
Start by creating a workflow in Dify, then add Apify tools to handle tasks like running Actors or fetching data.
- In the Dify Studio, create a new Workflow application.
- Choose Create from Blank.
- Click the + icon on the Start node and select an Apify tool to add it to your board.
Actions allow you to perform operations like running an Actor within a workflow. For instance, you could trigger a scraper and then use its results in subsequent steps.
- Add the Run Actor tool to your workflow.
- Configure it:
- Actor ID: The unique ID of the Actor to run. For example,
2Mdma1N6Fd0y3QEjRfor the Google Maps Scraper. - JSON body for input: The JSON input for the Actor run.
{ "language": "en", "locationQuery": "New York, USA", "maxCrawledPlacesPerSearch": 50, "searchStringsArray": [ "restaurant" ], "skipClosedPlaces": false } - Wait for finish: Select
Trueto make the workflow wait for the run to complete.
- Actor ID: The unique ID of the Actor to run. For example,
- Configure an End node and configure its output variable to use the
jsonresult from the Run Actor node.
After that we can start the workflow and see the results.
- Add the Run Actor task tool to your workflow.
- Enter the Task ID you want to execute (e.g.,
FThsabHGXorVhWbPV). - Add an End node and map its output variable to the
jsonresult from this tool.
- Add the Scrape Single URL tool.
- Enter the URL to scrape (e.g.,
https://docs.apify.com/). - Select the Crawler type. Raw HTTP is recommended for speed to work within Dify's timeout limits.
- Add an End node and map its output variable to the
jsonresult.
- Add the Get Dataset Items tool.
- Enter the Dataset ID to retrieve items from. (e.g.,
58S2Um7hSXWYghZhn) - Add an End node and map its output to the tool's
jsonresult.
- Add the Get Key-Value Store tool.
- Enter the Store ID and Key for the record you want to retrieve. (e.g., Store ID
fC0qZmL5RWIxoJG8z, Record KeyINPUT) - Add an End node and map its output to the tool's
jsonresult.
Triggers let your Dify application respond automatically to events in Apify, such as when an Actor run finishes. This is ideal for creating event-driven automations.
- In your Dify app, go to Overview > Endpoints.
- Click the + icon to create a new endpoint.
- Select the Workflow or Chatflow application you want to trigger and give it a name.
- Save the endpoint. Dify will generate two URLs.
- Copy the URL that corresponds to your application type (Workflow or Chatflow).
- In the Apify Console, open the Actor you want to use as a trigger.
- Go to the Integrations tab and select the HTTP webhook option.
- Paste the Dify endpoint URL.
- Under Events, select Run succeeded.
- Save the integration.
IMPORTANT: Publish Required A Dify Workflow or Chatflow must be published for the webhook trigger to work. If the application is not published, the webhook will fail.
To confirm that your webhook is working, you can create a simple workflow that catches the incoming data from Apify and sends it to a third-party request catcher like Webhook.site. This provides an easy way to inspect the data we send.

Now we can start the Actor in the Apify Console and it will trigger our workflow.
The setup for a Chatflow is nearly the same. The only differences are to select your Chatflow app instead of a Workflow and to copy the specific Chatflow endpoint URL.
Chatflow Trigger Requirement Also, when triggering a Chatflow, you must provide a Payload template in the Apify webhook settings. This template needs a
queryfield to serve as the first message to the chatflow.
When an event in Apify triggers your Dify endpoint, Apify sends a detailed nested response JSON object containing information about the event. We can use this data to power our workflow.
Dify cannot directly use nested syntax like resource.id in its variable system. Instead, it requires you to access nested properties using a flattened format (resource__id), where each level of nesting is represented by a double underscore (__).
To work with a nested property in your workflow, you must first define it as an input variable in your workflow's Start node by clicking +.
We can also use that variable inside a JSON object we send and see the results.
- Ensure your JSON inputs in fields are valid and properly formatted.
If you have any questions or need help, feel free to reach out to us on our developer community on Discord.

























