> ## Documentation Index
> Fetch the complete documentation index at: https://generaltranslation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 사용자 멘션 타임라인

> 특정 사용자가 멘션된 포스트를 가져옵니다

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

이 가이드는 특정 사용자를 언급한 포스트를 가져오는 방법을 단계별로 안내합니다.

<Note>
  **사전 준비 사항**

  시작하기 전에 다음이 필요합니다:

  * 승인된 App이 있는 [개발자 계정](https://developer.x.com/en/portal/petition/essential/basic-info)
  * App의 Bearer 토큰(공개 데이터용) 또는 사용자 액세스 토큰(비공개 지표용)
</Note>

***

<div id="get-user-mentions">
  ## 사용자 멘션 가져오기
</div>

<Steps>
  <Step title="사용자 ID 가져오기">
    [user lookup endpoint](/ko/x-api/users/lookup/introduction)를 사용하여 사용자 ID를 찾습니다. 예를 들어, @XDevelopers의 사용자 ID는 `2244994945`입니다.
  </Step>

  <Step title="멘션 타임라인 요청하기">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/users/2244994945/mentions?\
      tweet.fields=created_at,public_metrics,author_id&\
      expansions=author_id&\
      user.fields=username,verified&\
      max_results=10" \
        -H "Authorization: Bearer $BEARER_TOKEN"
      ```

      ```python Python SDK theme={null}
      from xdk import Client

      client = Client(bearer_token="YOUR_BEARER_TOKEN")

      # 페이지네이션을 사용해 멘션 타임라인 가져오기
      for page in client.posts.get_user_mentions(
          "2244994945",
          tweet_fields=["created_at", "public_metrics", "author_id"],
          expansions=["author_id"],
          user_fields=["username", "verified"],
          max_results=10
      ):
          for post in page.data:
              print(f"@{post.author_id}: {post.text[:50]}...")
      ```

      ```javascript JavaScript SDK theme={null}
      import { Client } from "@xdevplatform/xdk";

      const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

      // 페이지네이션을 사용해 멘션 타임라인 가져오기
      const paginator = client.posts.getUserMentions("2244994945", {
        tweetFields: ["created_at", "public_metrics", "author_id"],
        expansions: ["author_id"],
        userFields: ["username", "verified"],
        maxResults: 10,
      });

      for await (const page of paginator) {
        page.data?.forEach((post) => {
          console.log(`@${post.author_id}: ${post.text?.slice(0, 50)}...`);
        });
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="응답 확인하기">
    ```json theme={null}
    {
      "data": [
        {
          "id": "1301573587187331074",
          "text": "Hey @XDevelopers, 새로운 API 정말 마음에 들어요!",
          "author_id": "1234567890",
          "created_at": "2024-01-15T10:30:00.000Z",
          "public_metrics": {
            "retweet_count": 5,
            "reply_count": 2,
            "like_count": 42,
            "quote_count": 1
          }
        }
      ],
      "includes": {
        "users": [
          {
            "id": "1234567890",
            "username": "developer",
            "name": "Dev Person",
            "verified": false
          }
        ]
      },
      "meta": {
        "newest_id": "1301573587187331074",
        "oldest_id": "1301573587187331074",
        "result_count": 1,
        "next_token": "t3buvdr5pujq9g7bggsnf3ep2ha28"
      }
    }
    ```
  </Step>
</Steps>

***

<div id="filter-mentions">
  ## 멘션 필터링
</div>

<div id="exclude-replies">
  ### 답글 제외
</div>

사용자를 멘션한 원본 포스트만 가져오려면:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/users/2244994945/mentions?\
  exclude=replies&\
  max_results=10" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # 답글을 제외한 멘션 가져오기
  for page in client.posts.get_user_mentions(
      "2244994945",
      exclude=["replies"],
      max_results=10
  ):
      for post in page.data:
          print(post.text)
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // 답글을 제외한 멘션 가져오기
  const paginator = client.posts.getUserMentions("2244994945", {
    exclude: ["replies"],
    maxResults: 10,
  });

  for await (const page of paginator) {
    page.data?.forEach((post) => {
      console.log(post.text);
    });
  }
  ```
</CodeGroup>

<div id="get-mentions-in-a-time-range">
  ### 시간 범위 내 멘션 가져오기
</div>

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/users/2244994945/mentions?\
  start_time=2024-01-01T00%3A00%3A00Z&\
  end_time=2024-01-31T23%3A59%3A59Z" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # 시간 범위 내 멘션 가져오기
  for page in client.posts.get_user_mentions(
      "2244994945",
      start_time="2024-01-01T00:00:00Z",
      end_time="2024-01-31T23:59:59Z"
  ):
      for post in page.data:
          print(f"{post.created_at}: {post.text[:50]}...")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // 시간 범위 내 멘션 가져오기
  const paginator = client.posts.getUserMentions("2244994945", {
    startTime: "2024-01-01T00:00:00Z",
    endTime: "2024-01-31T23:59:59Z",
  });

  for await (const page of paginator) {
    page.data?.forEach((post) => {
      console.log(`${post.created_at}: ${post.text?.slice(0, 50)}...`);
    });
  }
  ```
</CodeGroup>

***

<div id="common-parameters">
  ## 공통 매개변수
</div>

| 매개변수               | 설명                               | 기본값 |
| :----------------- | :------------------------------- | :-- |
| `max_results`      | 페이지당 결과 수 (1-100)                | 10  |
| `start_time`       | 가장 오래된 게시물의 타임스탬프 (ISO 8601)     | —   |
| `end_time`         | 가장 최신 게시물의 타임스탬프 (ISO 8601)      | —   |
| `since_id`         | 이 id 이후의 포스트를 반환                 | —   |
| `until_id`         | 이 id 이전의 포스트를 반환                 | —   |
| `exclude`          | `retweets`, `replies` 또는 둘 다를 제외 | —   |
| `pagination_token` | 다음 페이지에 대한 토큰                    | —   |

***

<div id="next-steps">
  ## 다음 단계
</div>

<CardGroup cols={2}>
  <Card title="홈 타임라인" icon="house" href="/ko/x-api/posts/timelines/quickstart/reverse-chron-quickstart">
    사용자의 홈 타임라인 가져오기
  </Card>

  <Card title="통합 가이드" icon="book" href="/ko/x-api/posts/timelines/integrate">
    핵심 개념과 모범 사례 알아보기
  </Card>

  <Card title="API 참조 문서" icon="code" href="/ko/x-api/posts/user-mention-timeline-by-user-id">
    전체 엔드포인트 문서 보기
  </Card>

  <Card title="페이지네이션 가이드" icon="arrow-right" href="/ko/x-api/fundamentals/pagination">
    대용량 결과 집합 탐색하기
  </Card>
</CardGroup>
