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

# Subscribe Conversation

The `subscribeConversation` subscription allows you to listen for real-time updates to a conversation, including new messages and response streams, via a WebSocket-based subscription model.

## Signature

```graphql theme={null}
subscribeConversation(
  auth: SubscriptionAuthInput!
  conversationId: String!
): [ConversationUpdateOneOf!]!
```

## Arguments

<ParamField path="auth" type="SubscriptionAuthInput!" required>
  Authentication credentials for the subscription. See [SubscriptionAuthInput](/integrations/graphql-api/objects/subscription-auth-input).
</ParamField>

<ParamField path="conversationId" type="String!" required>
  The unique identifier of the conversation to subscribe to.
</ParamField>

## Response

Returns an array of `ConversationUpdateOneOf` objects representing conversation updates. See [ConversationUpdateOneOf](/integrations/graphql-api/objects/conversation-update-one-of) for the schema.

## Usage example

A very simple example to get you started is to do the following:

```graphql theme={null}
subscription SubscribeConversation(
  $auth: SubscriptionAuthInput!
  $conversationId: String!
) {
  subscribeConversation(
    auth: $auth
    conversationId: $conversationId
  ) {
    assistantMessageSent {
      id
      body {
        ops {
          insert {
            text
            visualization {
              id
              title
              type
              highchartsOptions
            }
          }
        }
      }
      sender
      createdAt
    }
    assistantResponseDiff {
      bodyDiff {
        ops {
          insert {
            text
          }
          visualization {
            id
            title
            type
            highchartsOptions
          }
        }
      }
      sender
      inProgress
    }
    assistantResponseCancelled
  }
}
```

<RequestExample>
  ```bash Request theme={null}
  wscat -c wss://{ACCOUNT}.askwisdom.ai/graphql \
    -H "Authorization: Bearer <jwt_token>" \
    -s graphql-ws \
    --execute '{
      "type": "start",
      "payload": {
        "query": "subscription SubscribeConversation($auth: SubscriptionAuthInput!, $conversationId: String!) { subscribeConversation(auth: $auth, conversationId: $conversationId) { assistantMessageSent { id body { ops { insert { text } } } sender createdAt } assistantResponseDiff { bodyDiff { ops { insert { text } } } sender inProgress } assistantResponseCancelled } }",
        "variables": {
          "auth": {
            "token": "<jwt_token>"
          },
          "conversationId": "conv_123456789"
        }
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": {
      "subscribeConversation": [
        {
          "assistantMessageSent": {
            "id": "msg_987654321",
            "body": {
              "ops": [
                {
                  "insert": {
                    "text": "Here's the analysis you requested:"
                  }
                }
              ]
            },
            "sender": "ASSISTANT",
            "createdAt": "2024-01-15T10:30:00Z"
          },
          "assistantResponseDiff": null,
          "assistantResponseCancelled": null
        }
      ]
    }
  }
  ```
</ResponseExample>

## Related operation

<CardGroup cols={2}>
  <Card title="ConversationUpdateOneOf Schema" icon="cube" href="/integrations/graphql-api/objects/conversation-update-one-of">
    Learn about conversation update types
  </Card>
</CardGroup>
