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: commentsApi
url: ../openapi/_superseded/youtube-comments-api-openapi.yml
type: openapi
- name: commentthreadsApi
url: ../openapi/youtube-comment-threads-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: $sourceDescriptions.commentthreadsApi.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: $sourceDescriptions.commentsApi.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
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.