X (Twitter) · Arazzo Workflow

X List the Posts a Handle Has Liked

Version 1.0.0

Resolve a username to an id, then fetch that user's liked posts.

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

Provider

twitter

Workflows

liked-posts-of-handle
Resolve a username and list the posts that user has liked.
Chains the username lookup endpoint into the liked-posts endpoint so a caller can go from a handle to that user's liked posts.
2 steps inputs: authorization, maxResults, username outputs: likedPosts, userId
1
resolveUser
getUsersByUsername
Resolve the username into a numeric user id.
2
getLikedPosts
getUsersLikedPosts
Retrieve the posts the resolved user has liked.

Source API Descriptions

Arazzo Workflow Specification

twitter-liked-posts-of-handle-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: X List the Posts a Handle Has Liked
  summary: Resolve a username to an id, then fetch that user's liked posts.
  description: >-
    Resolves an X account by its @username and then retrieves the posts that
    account has liked. The lookup step requests the user.fields needed to chain,
    and the liked-posts step inlines the tweet.fields and max_results so the
    flow 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: liked-posts-of-handle
  summary: Resolve a username and list the posts that user has liked.
  description: >-
    Chains the username lookup endpoint into the liked-posts endpoint so a
    caller can go from a handle to that user's liked posts.
  inputs:
    type: object
    required:
    - username
    properties:
      username:
        type: string
        description: The @username whose liked posts to list, without the leading @.
      maxResults:
        type: integer
        description: The maximum number of liked posts to return (5-100).
        default: 25
      authorization:
        type: string
        description: Bearer token to authorize the requests (e.g. "Bearer xxx").
  steps:
  - stepId: resolveUser
    description: Resolve the username into a numeric user id.
    operationId: getUsersByUsername
    parameters:
    - name: username
      in: path
      value: $inputs.username
    - name: user.fields
      in: query
      value: id,name,username
    - name: Authorization
      in: header
      value: $inputs.authorization
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      userId: $response.body#/data/id
  - stepId: getLikedPosts
    description: Retrieve the posts the resolved user has liked.
    operationId: getUsersLikedPosts
    parameters:
    - name: id
      in: path
      value: $steps.resolveUser.outputs.userId
    - name: max_results
      in: query
      value: $inputs.maxResults
    - name: tweet.fields
      in: query
      value: id,text,author_id,created_at
    - name: Authorization
      in: header
      value: $inputs.authorization
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      likedPosts: $response.body#/data
      nextToken: $response.body#/meta/next_token
  outputs:
    userId: $steps.resolveUser.outputs.userId
    likedPosts: $steps.getLikedPosts.outputs.likedPosts