Ai chats

Create a new AI chat thread and send the first message to the AI agent.

Required permissions:

  • ai_chat:create
post/ai_chats

Request

  • Base URL
    https://api.whop.com/api/v1
  • Auth
    HTTP bearer

Request body

object required

Parameters for CreateAiChat

agent_identifier, 'general' | 'support' nullable

The AI agent that handles an AI chat.

current_account_id, string nullable

The unique identifier of the account to set as context for the AI chat (e.g., "biz_XXXXX").

message_attachments, object[] nullable

A list of previously uploaded file attachments to include with the first message.

message_source, 'manual' | 'suggestion' | 'link' nullable

The source of an AI chat message

message_text, string required

The text content of the first message to send to the AI agent.

suggestion_type, string nullable

The type of suggestion prompt that was clicked, when message_source is 'suggestion'.

title, string nullable

An optional display title for the AI chat thread (e.g., "Help with billing").

Response

A successful response

AiChat required

An AI-powered chat conversation belonging to a user, with optional scheduled automation.

agent_identifier, 'general' | 'support' required

The AI agent that handles this chat. Set when the chat is created and fixed for its lifetime.

blended_token_usage, string required

The total number of tokens consumed across all messages in this conversation.

created_at, string date-time required

The datetime the ai chat was created.

id, string required

The unique identifier for the ai chat.

last_message_at, string date-time nullable required

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

message_count, integer required

The total number of messages exchanged in this conversation.

notification_preference, 'all' | 'none' required

The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them.

title, string nullable required

A short descriptive title for this AI chat conversation. Null if no title has been set.

updated_at, string date-time required

The datetime the ai chat was last updated.

user, object required

The user who owns this AI chat conversation.

Example response

{
  "blended_token_usage": "123.45",
  "created_at": "2023-12-01T05:00:00.401Z",
  "id": "aich_xxxxxxxxxxxxx",
  "last_message_at": "2023-12-01T05:00:00.401Z",
  "message_count": 42,
  "title": "Weekly Revenue Analysis",
  "updated_at": "2023-12-01T05:00:00.401Z",
  "user": {
    "id": "user_xxxxxxxxxxxxx"
  }
}

Changes

    • info

      added the new optional request property agent_identifier

    • info

      added the required property agent_identifier to the response with the status

    • warning

      removed the request property current_company_id

    1 more change in this revision