Youtube · Arazzo Workflow

YouTube Post and Moderate a Comment Thread

Version 1.0.0

Post a top-level comment on a video, then immediately set its moderation status.

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

Provider

youtube

Workflows

post-and-moderate-comment
Create a top-level comment and apply a moderation status to it.
Posts a new top-level comment via commentThreads.insert and then applies a moderation status to the created comment via comments.setModerationStatus.
2 steps inputs: apiKey, commentText, moderationStatus, videoId outputs: moderatedCommentId, topLevelCommentId
1
postThread
youtube.commentThreads.insert
Create a new top-level comment thread on the video.
2
moderate
youtube.comments.setModerationStatus
Apply the requested moderation status to the newly created comment.

Source API Descriptions

Arazzo Workflow Specification

youtube-post-and-moderate-comment-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: YouTube Post and Moderate a Comment Thread
  summary: Post a top-level comment on a video, then immediately set its moderation status.
  description: >-
    A channel-owner flow that posts a comment and governs its visibility in one
    pass. It creates a new top-level comment thread on a video, captures the
    top-level comment id, and then sets the moderation status of that comment.
    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-and-moderate-comment
  summary: Create a top-level comment and apply a moderation status to it.
  description: >-
    Posts a new top-level comment via commentThreads.insert and then applies a
    moderation status to the created comment via comments.setModerationStatus.
  inputs:
    type: object
    required:
    - apiKey
    - videoId
    - commentText
    - moderationStatus
    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.
      moderationStatus:
        type: string
        description: The moderation status to apply (heldForReview, published, or rejected).
  steps:
  - stepId: postThread
    description: Create a new top-level comment thread on the 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: $inputs.videoId
          topLevelComment:
            snippet:
              textOriginal: $inputs.commentText
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      topLevelCommentId: $response.body#/snippet/topLevelComment/id
  - stepId: moderate
    description: Apply the requested moderation status to the newly created comment.
    operationId: youtube.comments.setModerationStatus
    parameters:
    - name: id
      in: query
      value: $steps.postThread.outputs.topLevelCommentId
    - name: moderationStatus
      in: query
      value: $inputs.moderationStatus
    - name: key
      in: query
      value: $inputs.apiKey
    successCriteria:
    - condition: $statusCode == 204
    outputs:
      moderatedCommentId: $steps.postThread.outputs.topLevelCommentId
  outputs:
    topLevelCommentId: $steps.postThread.outputs.topLevelCommentId
    moderatedCommentId: $steps.moderate.outputs.moderatedCommentId