Youtube · Arazzo Workflow

YouTube Post Comment Thread and Reply

Version 1.0.0

Post a top-level comment on a video and then add a reply to it.

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

Provider

youtube

Workflows

post-comment-thread-reply
Create a top-level comment thread, then reply to its top-level comment.
Posts a new top-level comment on a video via commentThreads.insert, then replies to it via comments.insert using the top-level comment id as the parent id.
2 steps inputs: apiKey, commentText, replyText, videoId outputs: replyId, threadId, topLevelCommentId
1
postThread
youtube.commentThreads.insert
Create a new top-level comment thread on the video and capture the id of the created top-level comment.
2
postReply
youtube.comments.insert
Reply to the top-level comment created above by inserting a comment whose parentId is the top-level comment id.

Source API Descriptions

Arazzo Workflow Specification

youtube-post-comment-thread-reply-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: YouTube Post Comment Thread and Reply
  summary: Post a top-level comment on a video and then add a reply to it.
  description: >-
    Starts a discussion and follows up on it. It creates a new comment thread
    (a top-level comment) on a video, captures the id of the top-level comment,
    and then posts a reply to that comment using the comments.insert method with
    the captured parent id. 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: post-comment-thread-reply
  summary: Create a top-level comment thread, then reply to its top-level comment.
  description: >-
    Posts a new top-level comment on a video via commentThreads.insert, then
    replies to it via comments.insert using the top-level comment id as the
    parent id.
  inputs:
    type: object
    required:
    - apiKey
    - videoId
    - commentText
    - replyText
    properties:
      apiKey:
        type: string
        description: The Google API key used to authorize each YouTube Data API request.
      videoId:
        type: string
        description: The id of the video to comment on.
      commentText:
        type: string
        description: The text of the top-level comment to post.
      replyText:
        type: string
        description: The text of the reply to post under the top-level comment.
  steps:
  - stepId: postThread
    description: >-
      Create a new top-level comment thread on the video and capture the id of
      the created top-level comment.
    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: $inputs.videoId
          topLevelComment:
            snippet:
              textOriginal: $inputs.commentText
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      threadId: $response.body#/id
      topLevelCommentId: $response.body#/snippet/topLevelComment/id
  - stepId: postReply
    description: >-
      Reply to the top-level comment created above by inserting a comment whose
      parentId is the top-level comment id.
    operationId: youtube.comments.insert
    parameters:
    - name: part
      in: query
      value: snippet
    - name: key
      in: query
      value: $inputs.apiKey
    requestBody:
      contentType: application/json
      payload:
        snippet:
          parentId: $steps.postThread.outputs.topLevelCommentId
          textOriginal: $inputs.replyText
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      replyId: $response.body#/id
  outputs:
    threadId: $steps.postThread.outputs.threadId
    topLevelCommentId: $steps.postThread.outputs.topLevelCommentId
    replyId: $steps.postReply.outputs.replyId