Youtube · Arazzo Workflow

YouTube Discover and Comment

Version 1.0.0

Search for a video, confirm its details, then post a top-level comment on it.

1 workflow 1 source API 1 provider
View Spec View on GitHub GoogleMediaSocialStreamingVideoVideosArazzoWorkflows

Provider

youtube

Workflows

discover-and-comment
Find a video by query and post a comment on it.
Searches for a video, reads its full resource to confirm it, and posts a new top-level comment thread on that video.
3 steps inputs: apiKey, commentText, query outputs: threadId, title, videoId
1
searchVideos
youtube.search.list
Search YouTube restricted to video resources and capture the first video id.
2
confirmVideo
youtube.videos.list
Read the matched video resource to confirm it exists before commenting.
3
postComment
youtube.commentThreads.insert
Post a new top-level comment thread on the confirmed video.

Source API Descriptions

Arazzo Workflow Specification

youtube-discover-and-comment-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: YouTube Discover and Comment
  summary: Search for a video, confirm its details, then post a top-level comment on it.
  description: >-
    A discover-then-engage flow. It searches YouTube for a video, confirms the
    top result by reading the video resource, and then posts a new top-level
    comment on that video. Every step spells out its request inline so the flow
    can be read and executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: youtubeDataApi
  url: ../openapi/youtube-data-api-openapi.yml
  type: openapi
workflows:
- workflowId: discover-and-comment
  summary: Find a video by query and post a comment on it.
  description: >-
    Searches for a video, reads its full resource to confirm it, and posts a new
    top-level comment thread on that video.
  inputs:
    type: object
    required:
    - apiKey
    - query
    - commentText
    properties:
      apiKey:
        type: string
        description: The Google API key used to authorize each YouTube Data API request.
      query:
        type: string
        description: The query term used to find a video.
      commentText:
        type: string
        description: The text of the top-level comment to post.
  steps:
  - stepId: searchVideos
    description: Search YouTube restricted to video resources and capture the first video id.
    operationId: youtube.search.list
    parameters:
    - name: part
      in: query
      value: snippet
    - name: q
      in: query
      value: $inputs.query
    - name: type
      in: query
      value: video
    - name: maxResults
      in: query
      value: 5
    - name: key
      in: query
      value: $inputs.apiKey
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      videoId: $response.body#/items/0/id/videoId
  - stepId: confirmVideo
    description: Read the matched video resource to confirm it exists before commenting.
    operationId: youtube.videos.list
    parameters:
    - name: part
      in: query
      value: snippet
    - name: id
      in: query
      value: $steps.searchVideos.outputs.videoId
    - name: key
      in: query
      value: $inputs.apiKey
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      title: $response.body#/items/0/snippet/title
  - stepId: postComment
    description: Post a new top-level comment thread on the confirmed video.
    operationId: youtube.commentThreads.insert
    parameters:
    - name: part
      in: query
      value: snippet
    - name: key
      in: query
      value: $inputs.apiKey
    requestBody:
      contentType: application/json
      payload:
        snippet:
          videoId: $steps.searchVideos.outputs.videoId
          topLevelComment:
            snippet:
              textOriginal: $inputs.commentText
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      threadId: $response.body#/id
  outputs:
    videoId: $steps.searchVideos.outputs.videoId
    title: $steps.confirmVideo.outputs.title
    threadId: $steps.postComment.outputs.threadId