New to Kestra?
Use blueprints to kickstart your first workflows.
Watch a YouTube video's view count with Kestra. A daily check compares views against a milestone threshold and celebrates in Discord when it crosses.
A view milestone is a marketing moment, but only if you notice it the day it happens. This blueprint points io.kestra.plugin.youtube.VideoStats at a single hero video once a day, compares the returned view count against a milestone threshold with an If task, and posts a Discord celebration the first morning the number crosses the line, current views, likes, and comments included. Until then, each run leaves a quiet log line, so the execution history doubles as a day-by-day growth record.
video_id and view_threshold inputs define which video to watch and what number counts as the milestone, both editable at execution time.fetch_stats (io.kestra.plugin.youtube.VideoStats) calls the YouTube Data API with the OAuth2 access token for the single video, with snippet metadata enabled so the title travels with the numbers. The output exposes the video at videos[0] with scalar viewCount, likeCount, commentCount, and title fields.check_milestone (io.kestra.plugin.core.flow.If) casts videos[0].viewCount to a number and compares it against the threshold.celebrate posts a Discord message with the scalar stats and the marketing follow-ups the milestone unlocks. Below the threshold, log_progress records today's count in the logs.errors block posts a distinct Discord alert when the check fails, and a disabled-by-default Schedule trigger runs the watch every morning at 09:00.The YouTube Data API returns the view count, but a milestone watch needs someone to ask daily, remember the threshold, branch on the answer, and tell the team at the right moment. Kestra declares all of that in one flow, the schedule, the comparison, the two branches, and the failure alert, with every daily check preserved in execution history.
YOUTUBE_ACCESS_TOKEN: OAuth2 bearer token for the YouTube Data API.DISCORD_WEBHOOK_URL: Discord incoming webhook URL.video_id with your hero video and set view_threshold to the next milestone.disabled: false on the daily trigger.view_threshold to the next round number and keep the watch running.then branch that creates a ticket or drafts the milestone social post automatically.