Full Pipedream Workflow and Code

Step 1: Gain Pipedream Access And Configure Trigger

  1. Go HERE to sign up for a FREE Pipedream Account

  2. Go to projects, and then new project

  3. Create a new workflow for whatever keyword you want to trigger

  4. Select the big “ADD TRIGGER” in the middle of the workflow and search for youtube data, then select new comment

  5. Configure the following:

    1. YouTube Data Account > Connect your youtube account

    2. Channel ID > Choose the YouTube channel that’s connected to your YouTube account

    3. Polling interval > Choose 15 minutes

    4. Press test workflow

Step 2: Configure The Keyword Filter Step

  1. Press the + below the trigger

  2. Search and select node

  3. Then choose Run Node code

  4. Rename the step to filter

  5. Replace the code with the following code:

    export default defineComponent({

    async run({ steps, $ }) {

    const rawText = steps.trigger?.event?.snippet?.textDisplay || "";

    const comment = rawText.trim().toLowerCase().replace(/[^\w\s]/gi, ""); // normalize input

    if (comment.includes("PASTE YOUTR KEYWORD HERE")) {

    return steps.trigger.event;

    }

    return $.flow.exit("No keyword match.");

    }

    });

Select test and then go to the next step

Step 3: Get You YouTube API Key And Your Channel ID

YouTube API Key

  1. Go To https://console.cloud.google.com/

  2. Log in with your YouTube account information

  3. Search APIs & Services

  4. Select YouTube Data API v3 in the API library

  5. Enable the API

  6. Go to Credentials on the left side

  7. Select + Create credentials

  8. It will make you a new API

  9. Copy that API and save it for later

Channel ID

  1. Go to your Youtube channel main page

  2. Click on your channel description where it says “…more”

  3. Scroll to the bottom and select Share channel

  4. Select copy channel ID

  5. Save this for later as well

Step 3: Configure The Check For Replies Step

  1. Press the + below the trigger

  2. Search and select node

  3. Then choose Run Node code

  4. Rename the step to duplicate

  5. Replace the code with the following code:

    import { axios } from "@pipedream/platform";

    export default defineComponent({

    async run({ steps, $ }) {

    const apiKey = "Insert Your YouTube API Key Here"; // your API key

    const parentId = steps.filter.$return_value.id;

    // Check for replies to this comment

    const res = await axios($, {

    method: "GET",

    url: `https://youtube.googleapis.com/youtube/v3/comments`,

    params: {

    part: "snippet",

    parentId,

    key: apiKey,

    },

    });

    const myChannelId = "Put Your Channel ID Here"; // your actual channel ID

    const hasReplied = res.items?.some(

    (c) => c.snippet.authorChannelId?.value === myChannelId

    );

    if (hasReplied) {

    return $.flow.exit("Already replied to this comment.");

    }

    return { parentId }; // return for use in reply step

    },

    });

Select test and then go to the next step

Step 4: Configure The Check For Replies Step

  1. Press the + below the trigger

  2. Search and select YouTube Data

  3. Then choose Reply To Comment

  4. Configure the following:

    1. YouTube Data Account > Connect your youtube account

    2. Channel ID > Choose the YouTube channel that’s connected to your YouTube account

    3. Comment Thread > {{steps.duplicate.$return_value.parentId}}

    4. Text > Put the comment reply with the link in that you want to reply to comments

Select test and then go to the next step

Step 4: Test This Thing

  1. Deploy the workflow in the top right corner

  2. Use another Youtube account to comment the keyword on your oldest least popular video. This can be your test video for future testing.

  3. Go to your deployed pipedream automation and select “Try Now”

  4. You should see the live events updating on the left and the workflow going through in the center.

  5. When it is complete, go back and refresh the youtube video you commented on and you should see your reply!

  6. If anything is wrong, re copy all of the code, check to make sure you don’t have any spaces in the channel ID or API Key

  7. If you really can’t figure it out, Email me at [email protected] and send me screenshots of each step

YOU’RE GOOD TO GO, YOU ARE FULLY AUTOMATED

Keep an eye out when future automations come out so you can fully leverage AI and automation to free up your time. I’ll make sure to make a YouTube video about each one and send an announcement in my newsletter as well.