Check if a user commented on a specific tweet
This endpoint provides a convenient way to check if a user identified by user_id
posted a comment in response to a tweet identified by tweet_id
. This endpoint only detects direct replies to a target tweet, and not comments posted under other comments.
The endpoint returns an array of comment_ids
taking into account that a single user may have posted more than a single reply.
Endpoint
Endpoint parameters
tweet_id (Required)
The numeric ID of the target tweet
1625802236571033602
user_id (Required)
The numeric ID of the user
1489552236571048124
Common Issues and Best Practices
In languages where the
tweet_id
oruser_id
value exceeds the default Integer type limit (e.g., Node.js), storetweet_id
anduser_id
as strings. Use theid_str
property returned by the API for these values
Approach
This endpoint performs a number of tests to detect the relevant comment with high accuracy and low latency:
SocialData will attempt to retrieve a user's Tweets and replies page and check if any of their recent replies were posted in response to the target
tweet_id
(i.e. wherein_reply_to_status_id == tweet_id
) - this requires that a user's profile privacy is set to public and not "protected"If the previous test fails, SocialData will also retrieve Twitter search results for the following query
conversation_id:TWEET_ID from:USERNAME
(i.e. any comments posted by the user under the target tweet)With each request SocialData will also dispatch an async job to retrieve the latest search results for
conversation_id:TWEET_ID
(i.e. any comments posted by any users in response to the targettweet_id
) - the job with cache all user_ids and their corresponding comment_ids and use this cache to verify actions on future requests
Before running tests #1 and #2, SocialData will check if the target user_id is already present in cache (e.g. if found by an async job earlier). If any records found in cache - SocialData will immediately return the response and skip both tests #1 and #2 to minimize the latency of this endpoint.
Known Limitations
While in general this endpoint provides highly accurate results, it may occasionally fail to detect any relevant comments, even if the user commented on the target tweet, in the following cases:
A comment was posted a long time ago and it is not found in the first few pages of the user's tweets and replies page, or in their comment search results
A comment was posted by a shadow-banned user (i.e. marked by Twitter as spam/bot account) and their comments don't show up in search
However, you are unlikely to experience any of these issues if the endpoint is called shortly after the user posted their comment.
Keep in mind that the endpoint will not detect any deleted comments - if a comment_id was detected earlier, it will be stored in cache even if the user deletes it, and will be returned in subsequent endpoint responses. If your app needs to detect if any of the relevant comments was deleted - use the tweet details endpoint to retrieve the comment. Any deleted comments will result in error 404 Not Found
Pricing
This endpoint has a flat-rate pricing of $0.008 per request regardless of how many tweets were scraped to detect the relevant comment.
Response codes
HTTP 200 OK - succeeded
HTTP 402 Payment Required - not enough credits to perform this request
HTTP 404 Not Found - requested target tweet does not exist
HTTP 422 Unprocessable Content - validation failed (e.g. one of the required parameters was not provided)
HTTP 500 Internal Server Error - other error, typically means that SocialData API failed to obtain the requested information and you should try again later
Rate limits
By default each user has a limit of 120 requests per minute shared across all endpoints. Please reach out to support@socialdata.tools if you need to raise your rate limit.
Example request
Example response
Last updated