arazzo: 1.0.1 info: title: X Find a Post, Repost It, Then Undo the Repost summary: Search for a post, repost the top match, then remove the repost. description: >- Demonstrates the repost lifecycle on the X API. The workflow searches recent posts for a query, reposts the first matching post from the authenticated account, and then undoes that repost. The repost step inlines its tweet_id body and the undo step inlines the source_tweet_id path parameter so the chain reads and executes without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: xApi url: ../openapi/x-api-openapi.json type: openapi workflows: - workflowId: repost-then-undo summary: Search, repost the top result, then undo the repost. description: >- Chains the recent-search endpoint into the repost endpoint and then the unrepost endpoint, branching to a no-op end when the search finds nothing. inputs: type: object required: - authUserId - query properties: authUserId: type: string description: The numeric id of the authenticated user performing the repost. query: type: string description: The search query used to find a post to repost. authorization: type: string description: OAuth2 user token to authorize the requests (e.g. "Bearer xxx"). steps: - stepId: findPost description: Search recent posts and capture the id of the first match. operationId: searchPostsRecent parameters: - name: query in: query value: $inputs.query - name: max_results in: query value: 10 - name: tweet.fields in: query value: id,text,author_id - name: Authorization in: header value: $inputs.authorization successCriteria: - condition: $statusCode == 200 outputs: postId: $response.body#/data/0/id onSuccess: - name: hasResults type: goto stepId: repost criteria: - context: $response.body condition: $.data.length > 0 type: jsonpath - name: noResults type: end criteria: - context: $response.body condition: $.data.length == 0 type: jsonpath - stepId: repost description: Repost the first matching post from the authenticated account. operationId: repostPost parameters: - name: id in: path value: $inputs.authUserId - name: Authorization in: header value: $inputs.authorization requestBody: contentType: application/json payload: tweet_id: $steps.findPost.outputs.postId successCriteria: - condition: $statusCode == 200 outputs: reposted: $response.body#/data/retweeted - stepId: undoRepost description: Undo the repost to restore the original state. operationId: unrepostPost parameters: - name: id in: path value: $inputs.authUserId - name: source_tweet_id in: path value: $steps.findPost.outputs.postId - name: Authorization in: header value: $inputs.authorization successCriteria: - condition: $statusCode == 200 outputs: reposted: $response.body#/data/retweeted outputs: postId: $steps.findPost.outputs.postId reposted: $steps.repost.outputs.reposted