Documentation Index
Fetch the complete documentation index at: https://generaltranslation.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
X의 모든 답글은 하나의 대화 스레드에 속합니다. conversation_id 필드를 사용하면 전체 대화 트리를 식별하고 추적하며 재구성할 수 있습니다.
누군가 게시물을 올리고 다른 사람들이 답글을 달면, 모든 답글에는 동일한 conversation_id가 설정됩니다. 이는 대화를 시작한 원본 게시물의 id입니다.
Original post (ID: 1234567890) ← conversation_id for all replies
├── Reply 1 (ID: 1234567891) → conversation_id: 1234567890
│ └── Reply to Reply 1 → conversation_id: 1234567890
└── Reply 2 (ID: 1234567892) → conversation_id: 1234567890
└── Reply to Reply 2 → conversation_id: 1234567890
스레드가 아무리 깊어져도 모든 포스트는 동일한 conversation_id를 가집니다.
tweet.fields에 conversation_id를 추가하세요:
curl "https://api.x.com/2/tweets/1234567891?tweet.fields=conversation_id,in_reply_to_user_id,referenced_tweets" \
-H "Authorization: Bearer $TOKEN"
응답:
{
"data": {
"id": "1234567891",
"text": "@user Great point!",
"conversation_id": "1234567890",
"in_reply_to_user_id": "2244994945",
"referenced_tweets": [{
"type": "replied_to",
"id": "1234567890"
}]
}
}
conversation_id를 검색 연산자로 사용하여 스레드의 모든 포스트를 가져올 수 있습니다.
curl "https://api.x.com/2/tweets/search/recent?\
query=conversation_id:1234567890&\
tweet.fields=author_id,created_at,in_reply_to_user_id&\
expansions=author_id" \
-H "Authorization: Bearer $TOKEN"
원본 게시물에 대한 모든 답글을 최신순으로 반환합니다.
전체 대화 트리를 구성합니다:import requests
conversation_id = "1234567890"
url = f"https://api.x.com/2/tweets/search/recent"
params = {
"query": f"conversation_id:{conversation_id}",
"tweet.fields": "author_id,in_reply_to_user_id,referenced_tweets,created_at",
"max_results": 100
}
response = requests.get(url, headers=headers, params=params)
replies = response.json()["data"]
# created_at 기준으로 정렬하여 시간순으로 정렬합니다.
replies.sort(key=lambda x: x["created_at"])
특정 대화에 대한 답글을 실시간으로 스트리밍합니다:# 특정 대화에 대한 필터링된 스트림 규칙 추가
curl -X POST "https://api.x.com/2/tweets/search/stream/rules" \
-H "Authorization: Bearer $TOKEN" \
-d '{"add": [{"value": "conversation_id:1234567890"}]}'
대화에서 답글 수를 집계합니다:curl "https://api.x.com/2/tweets/counts/recent?\
query=conversation_id:1234567890" \
-H "Authorization: Bearer $TOKEN"
| Field | Description |
|---|
conversation_id | 스레드를 시작한 원본 게시물의 ID |
in_reply_to_user_id | 답글 대상 게시물 작성자의 사용자 ID |
referenced_tweets | type: "replied_to" 및 부모 게시물 ID를 포함하는 배열 |
{
"data": [
{
"id": "1234567893",
"text": "@user2 @user1 I agree with you both!",
"conversation_id": "1234567890",
"author_id": "3333333333",
"created_at": "2024-01-15T12:05:00.000Z",
"in_reply_to_user_id": "2222222222",
"referenced_tweets": [{"type": "replied_to", "id": "1234567892"}]
},
{
"id": "1234567892",
"text": "@user1 That's interesting!",
"conversation_id": "1234567890",
"author_id": "2222222222",
"created_at": "2024-01-15T12:03:00.000Z",
"in_reply_to_user_id": "1111111111",
"referenced_tweets": [{"type": "replied_to", "id": "1234567890"}]
},
{
"id": "1234567891",
"text": "@user1 Great point!",
"conversation_id": "1234567890",
"author_id": "4444444444",
"created_at": "2024-01-15T12:02:00.000Z",
"in_reply_to_user_id": "1111111111",
"referenced_tweets": [{"type": "replied_to", "id": "1234567890"}]
}
],
"meta": {
"result_count": 3
}
}
- 원본 게시물의
conversation_id 값은 해당 게시물의 id와 동일합니다
conversation_id는 게시물을 반환하는 모든 v2 엔드포인트에서 제공됩니다
- 실시간으로 대화를 모니터링하려면 필터링된 스트림과 함께 사용하세요
- 대규모 스레드를 처리하려면 페이지네이션과 함께 사용하세요
포스트 검색
conversation_id를 기준으로 검색합니다.
필터링된 스트림
대화를 실시간으로 모니터링합니다.