If you don't have any experience with Zapier integration, you can read the article Getting started with Apify integration for Zapier.

For some use cases, you need to start the Web Scraper (apify/web-scraper) task with URL(s) from other Zapier steps. We use Zapier push button to trigger our Zap as an example in the tutorial. We then save the title and URL of the page we are currently on for the subsequent Zap steps. This use case mainly shows how you can start the Web Scraper with URL(s) from a previous Zap.

First, you have to create a simple Web Scraper task to scrape the title and the URL for the given start URL. You need to go to the Tasks section on your Apify account, click on the Create a new task button and choose Web Scraper from the list. You can name your new task whatever you like. We named it zapier-single-url-scraper. You need to update the input setting as follows:

  1. Uncheck the option to use request queue

  2. Clean all URLs from the pseudo-URLs option

  3. Clean all links from the link selector option

  4. Update the pageFunction with the following code:

async function pageFunction(context) {
    const $ = context.jQuery;

    const result = {
        title: $('title').text(),
        url: context.request.url,
    // Saves result to key-value store under OUTPUT key.
    await context.setValue('OUTPUT', result);

After you finish all the changes, the updated task input should look like this:

You can run the task using the Save & Run button. The task should return a URL and a title to the key-values store with OUTPUT key.

  "title": "Web Scraping, Data Extraction and Automation · Apify",
  "url": "https://apify.com"

When you have the task ready, you can move to Zapier and set up your Zap. If you don't have a Zapier account, you need to create one. Then you can click on Make a Zap button in your Zapier dashboard. You need to choose Push by Zapier as the trigger for the Zap. Then you need to choose New push from the first set of options.

You probably need to install the Zapier Chrome extension, where you can click on the Zapier button. After you successfully test the first step, you have to choose Apify as the second step, where you need to select the Task Run action.

After you click on the Save and Continue button, you have to choose to connect your Apify account. If you connect your Apify account, you can configure the Run Task action. You need to select the task you created into the Task field. The magic comes with the Input JSON overrides field, where you need to fill JSON with override task input settings. In the following example, we pass one start URL with the value from the previous step.

  "startUrls": [
      "url": "{{URL_from_previous_step}}"

The final task run setup looks like this:

Now you can click on the Continue button and Send the test to Apify. You should see a new task run in your Apify account with updated input.

That's all - now you can go to any page in your browser and click on Push by Zapier button, and you will start a new task run with the URL of your current browser window. If you need any help, just contact us on support@apify.com.

Did this answer your question?