Resolve a user, fetch their latest post, and list its liking users.
Chains the username lookup endpoint into the user-posts endpoint and then the liking-users endpoint, branching to a no-op end when the user has no posts.
arazzo: 1.0.1
info:
title: X Audit Engagement on a User's Latest Post
summary: Resolve a handle, get their latest post, then list who liked it.
description: >-
Produces a small engagement audit for an X account. The workflow resolves a
username to an id, retrieves that user's single most recent post, and then
lists the users who liked that post. Each step inlines its field selections
so the chain reads and executes without opening the underlying OpenAPI
description.
version: 1.0.0
sourceDescriptions:
- name: tweetsApi
url: ../openapi/twitter-tweets-api-openapi.yml
type: openapi
- name: usersApi
url: ../openapi/twitter-users-api-openapi.yml
type: openapi
workflows:
- workflowId: post-engagement-audit
summary: Resolve a user, fetch their latest post, and list its liking users.
description: >-
Chains the username lookup endpoint into the user-posts endpoint and then
the liking-users endpoint, branching to a no-op end when the user has no
posts.
inputs:
type: object
required:
- username
properties:
username:
type: string
description: The @username to audit, without the leading @.
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: latestPost
description: Retrieve the single most recent original post for the resolved user.
operationId: getUsersPosts
parameters:
- name: id
in: path
value: $steps.resolveUser.outputs.userId
- name: max_results
in: query
value: 5
- name: exclude
in: query
value: replies,retweets
- name: tweet.fields
in: query
value: id,text,public_metrics
- name: Authorization
in: header
value: $inputs.authorization
successCriteria:
- condition: $statusCode == 200
outputs:
latestPostId: $response.body#/data/0/id
onSuccess:
- name: hasPosts
type: goto
stepId: likingUsers
criteria:
- context: $response.body
condition: $.data.length > 0
type: jsonpath
- name: noPosts
type: end
criteria:
- context: $response.body
condition: $.data.length == 0
type: jsonpath
- stepId: likingUsers
description: List the users who liked the resolved user's latest post.
operationId: getPostsLikingUsers
parameters:
- name: id
in: path
value: $steps.latestPost.outputs.latestPostId
- name: max_results
in: query
value: 100
- name: user.fields
in: query
value: id,name,username
- name: Authorization
in: header
value: $inputs.authorization
successCriteria:
- condition: $statusCode == 200
outputs:
likingUsers: $response.body#/data
resultCount: $response.body#/meta/result_count
outputs:
userId: $steps.resolveUser.outputs.userId
latestPostId: $steps.latestPost.outputs.latestPostId
likingUsers: $steps.likingUsers.outputs.likingUsers
Discovery needs no key. Ratings and market analysis are Pro.
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. See our Privacy Policy and
Terms.