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

# Embed Chat

Embed a streamlined, white-label version of WisdomAI Chat directly into your application.

The page is loaded in an `iframe` and intentionally omits WisdomAI branding and features for a seamless integration experience. All core chat capabilities (natural‑language Q\&A, table generation, and chart rendering) remain intact.

<Info>
  The embedded chat UI is hosted at: `https://<customer>.askwisdom.ai/chat/embed`
</Info>

## Key Components

<CardGroup cols={2}>
  <Card title="Embedded Chat Page" icon="message">
    Minimal WisdomAI chat UI rendered in the iframe
  </Card>

  <Card title="GraphQL API" icon="code">
    Programmatically creates and manages chat sessions
  </Card>

  <Card title="Descope M2M Auth" icon="shield-check">
    Machine-to-machine JWT authentication using partner-specific API keys
  </Card>
</CardGroup>

## End-to-End Workflow

<Steps>
  <Step title="New Chat Trigger" titleSize="h3">
    User clicks **New Chat** on your platform
  </Step>

  <Step title="Backend Creates Chat Session" titleSize="h3">
    The platform's backend calls the `createConversation` mutation on WisdomAI GraphQL API and receives a `conversationId`
  </Step>

  <Step title="Load Embedded Chat" titleSize="h3">
    Your platform renders the iframe:

    ```html
    <iframe
      src="https://<customer>.askwisdom.ai/chat/embed/{conversationId}?token=<signed-jwt>"
      style="width: 100%; height: 100%; border: 0;" />
    ```
  </Step>

  <Step title="Seamless Interaction" titleSize="h3">
    The embedded page controls the chat experience; no further state management is required after the initial load.
  </Step>
</Steps>

## GraphQL API Capabilities

| Operation            | Type     | Description                                                   |
| -------------------- | -------- | ------------------------------------------------------------- |
| `createConversation` | Mutation | Creates a new blank chat session and returns `conversationId` |
| `conversations`      | Query    | Retrieves all conversations based on limit and offset         |

## Machine-to-Machine Authentication Flow

<Steps>
  <Step title="API Key Provisioning" titleSize="h3">
    WisdomAI generates a dedicated access key in the Descope portal and shares it with you. Reach out to our API team at `support@askwisdom.ai` to get a dedicated access key.
  </Step>

  <Step title="JWT Signing" titleSize="h3">
    Use the following GraphQL API to get a JWT from the access key

    ```graphql
    query ExchangeAccessToken($accessKey: String!) {
      exchangeAccessToken(accessToken: $accessKey)
    }
    ```
  </Step>

  <Step title="Request Authorization" titleSize="h3">
    Attach the signed JWT to every GraphQL request:

    ```
    Authorization: Bearer <signed-jwt>
    ```
  </Step>
</Steps>

<Info>
  For detailed information about the authentication flow and API usage, see the [Exchange Access Token](/integrations/graphql-api/queries/auth/exchange-access-token) documentation.
</Info>
