Full Pipedream Workflow and Code
Step 1: Gain Pipedream Access And Configure Trigger
Go HERE to sign up for a FREE Pipedream Account
Go to projects, and then new project
Create a new workflow for whatever keyword you want to trigger
Select the big “ADD TRIGGER” in the middle of the workflow and search for youtube data, then select new comment
Configure the following:
YouTube Data Account > Connect your youtube account
Channel ID > Choose the YouTube channel that’s connected to your YouTube account
Polling interval > Choose 15 minutes
Press test workflow
Step 2: Configure The Keyword Filter Step
Press the + below the trigger
Search and select node
Then choose Run Node code
Rename the step to filter
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
Go To https://console.cloud.google.com/
Log in with your YouTube account information
Search APIs & Services
Select YouTube Data API v3 in the API library
Enable the API
Go to Credentials on the left side
Select + Create credentials
It will make you a new API
Copy that API and save it for later
Channel ID
Go to your Youtube channel main page
Click on your channel description where it says “…more”
Scroll to the bottom and select Share channel
Select copy channel ID
Save this for later as well
Step 3: Configure The Check For Replies Step
Press the + below the trigger
Search and select node
Then choose Run Node code
Rename the step to duplicate
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
Press the + below the trigger
Search and select YouTube Data
Then choose Reply To Comment
Configure the following:
YouTube Data Account > Connect your youtube account
Channel ID > Choose the YouTube channel that’s connected to your YouTube account
Comment Thread > {{steps.duplicate.$return_value.parentId}}
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
Deploy the workflow in the top right corner
Use another Youtube account to comment the keyword on your oldest least popular video. This can be your test video for future testing.
Go to your deployed pipedream automation and select “Try Now”
You should see the live events updating on the left and the workflow going through in the center.
When it is complete, go back and refresh the youtube video you commented on and you should see your reply!
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
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