wscat -c wss://{ACCOUNT}.askwisdom.ai/graphql \
  -H "Authorization: Bearer your_api_key" \
  -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": "your_jwt_token_here"
        },
        "conversationId": "conv_123456789"
      }
    }
  }'
{
  "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
      }
    ]
  }
}

Overview

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

subscribeConversation(
  auth: SubscriptionAuthInput!
  conversationId: String!
): [ConversationUpdateOneOf!]!

Arguments

auth
SubscriptionAuthInput!
required
Authentication credentials for the subscription. See SubscriptionAuthInput.
conversationId
String!
required
The unique identifier of the conversation to subscribe to.

Response

Returns an array of ConversationUpdateOneOf objects representing conversation updates. See ConversationUpdateOneOf for the schema.

Usage Example

A very simple example to get you started is to do the following:
subscription SubscribeConversation(
  $auth: SubscriptionAuthInput!
  $conversationId: String!
) {
  subscribeConversation(
    auth: $auth
    conversationId: $conversationId
  ) {
    assistantMessageSent {
      id
      body {
        ops {
          insert {
            text
            visualization {
              id
              title
              type
            }
          }
        }
      }
      sender
      createdAt
    }
    assistantResponseDiff {
      bodyDiff {
        ops {
          insert {
            text
          }
          visualization {
            id
            title
            type
          }
        }
      }
      sender
      inProgress
    }
    assistantResponseCancelled
  }
}
wscat -c wss://{ACCOUNT}.askwisdom.ai/graphql \
  -H "Authorization: Bearer your_api_key" \
  -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": "your_jwt_token_here"
        },
        "conversationId": "conv_123456789"
      }
    }
  }'
{
  "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
      }
    ]
  }
}