X (Twitter) · Arazzo Workflow

X Quote a Post Found by Search

Version 1.0.0

Search recent posts, then publish a quote post of the top match.

1 workflow 1 source API 1 provider
View Spec View on GitHub Social MediaMicrobloggingReal-Time DataStreamingAdvertisingContentArazzoWorkflows

Provider

twitter

Workflows

quote-post-from-search
Search recent posts and quote the top result.
Chains the recent-search endpoint into the create-post endpoint using the quote_tweet_id field, branching to a no-op end when no post matches.
2 steps inputs: authorization, query, text outputs: quotePostId, quotedPostId
1
findPost
searchPostsRecent
Search recent posts and capture the id of the first match.
2
quote
createPosts
Publish a new quote post that references the first matching post.

Source API Descriptions

Arazzo Workflow Specification

twitter-quote-post-from-search-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: X Quote a Post Found by Search
  summary: Search recent posts, then publish a quote post of the top match.
  description: >-
    Searches the last seven days of posts for a query and then publishes a new
    quote post that references the first matching post. The search step inlines
    its tweet.fields and the quote step inlines the text and quote_tweet_id body
    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: quote-post-from-search
  summary: Search recent posts and quote the top result.
  description: >-
    Chains the recent-search endpoint into the create-post endpoint using the
    quote_tweet_id field, branching to a no-op end when no post matches.
  inputs:
    type: object
    required:
    - query
    - text
    properties:
      query:
        type: string
        description: The search query used to find a post to quote.
      text:
        type: string
        description: The text body of the quote post.
      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: quote
      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: quote
    description: Publish a new quote post that references the first matching post.
    operationId: createPosts
    parameters:
    - name: Authorization
      in: header
      value: $inputs.authorization
    requestBody:
      contentType: application/json
      payload:
        text: $inputs.text
        quote_tweet_id: $steps.findPost.outputs.postId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      quotePostId: $response.body#/data/id
      quotePostText: $response.body#/data/text
  outputs:
    quotedPostId: $steps.findPost.outputs.postId
    quotePostId: $steps.quote.outputs.quotePostId