> ## 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>;
};

Activity Stream 엔드포인트는 구독한 사용자 계정의 활동 이벤트를 실시간으로 제공합니다. 사용자가 게시물을 작성하거나, 좋아요를 누르거나, 팔로우하거나, DM을 받는 등의 이벤트를 수신할 수 있습니다.

<div id="overview">
  ## 개요
</div>

<CardGroup cols={2}>
  <Card title="실시간" icon="bolt">
    이벤트가 실시간으로 전달됩니다
  </Card>

  <Card title="종합적" icon="list">
    포스트, 좋아요, 팔로우, DM 등
  </Card>

  <Card title="구독형" icon="bell">
    사용자 활동을 구독합니다
  </Card>

  <Card title="Webhook 전달" icon="webhook">
    이벤트가 서버로 전달됩니다
  </Card>
</CardGroup>

***

<div id="event-types">
  ## 이벤트 유형
</div>

| Event                   | Description               |
| :---------------------- | :------------------------ |
| `tweet_create_events`   | 사용자가 새 게시물을 게시함           |
| `favorite_events`       | 사용자가 게시물에 좋아요를 누름         |
| `follow_events`         | 사용자가 다른 사용자를 팔로우하거나 팔로우됨  |
| `direct_message_events` | 사용자가 DM을 보내거나 받음          |
| `block_events`          | 사용자가 다른 사용자를 차단하거나 차단 해제함 |
| `mute_events`           | 사용자가 다른 사용자를 뮤트하거나 뮤트 해제함 |

***

<div id="endpoints">
  ## 엔드포인트
</div>

| Method | Endpoint                                                                              | Description  |
| :----- | :------------------------------------------------------------------------------------ | :----------- |
| GET    | [`/2/activity/stream`](/ko/x-api/activity/activity-stream)                            | 액티비티 스트림에 연결 |
| POST   | [`/2/activity/subscriptions`](/ko/x-api/activity/create-x-activity-subscription)      | 구독 생성        |
| GET    | [`/2/activity/subscriptions`](/ko/x-api/activity/get-x-activity-subscriptions)        | 구독 목록 조회     |
| PUT    | [`/2/activity/subscriptions/:id`](/ko/x-api/activity/update-x-activity-subscription)  | 구독 업데이트      |
| DELETE | [`/2/activity/subscriptions/:id`](/ko/x-api/activity/deletes-x-activity-subscription) | 구독 삭제        |

***

<div id="how-it-works">
  ## 동작 방식
</div>

1. **구독 생성** — 사용자의 활동을 구독합니다
2. **스트림에 연결** — 지속적인 연결을 설정합니다
3. **이벤트 수신** — 실시간 활동 이벤트를 받습니다
4. **이벤트 처리** — 애플리케이션에서 이벤트를 처리합니다

***

<div id="example-connect-to-stream">
  ## 예제: 스트림에 연결하기
</div>

```python theme={null}
import requests

def stream_activity(bearer_token):
    url = "https://api.x.com/2/activity/stream"
    headers = {"Authorization": f"Bearer {bearer_token}"}
    
    response = requests.get(url, headers=headers, stream=True)
    
    for line in response.iter_lines():
        if line:
            print(line.decode("utf-8"))
```

***

<div id="getting-started">
  ## 시작하기
</div>

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

  * 승인된 [개발자 계정](https://developer.x.com/en/portal/petition/essential/basic-info)
  * 개발자 콘솔의 [Project 및 App](/ko/resources/fundamentals/developer-apps)
  * App의 [Bearer 토큰](/ko/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <Card title="빠른 시작" icon="rocket" href="/ko/x-api/activity/quickstart">
    첫 구독을 설정하세요
  </Card>

  <Card title="Account Activity API" icon="bell" href="/ko/x-api/account-activity/introduction">
    Webhook 기반 대체 방식
  </Card>

  <Card title="API 참조 문서" icon="code" href="/ko/x-api/activity/activity-stream">
    전체 엔드포인트에 대한 문서
  </Card>
</CardGroup>
