Core Assistant Endpoints

Create Assistant

Creates a new AI assistant for your organization.

Endpoint

POST /api/ai-hub/assistant

Request Body

{
  "name": "Customer Support Bot",
  "description": "AI assistant for handling customer inquiries",
  "preferences": {
    "interface": {
      "header_background_color": "#1E40AF",
      "header_text_color": "#FFFFFF",
      "chat_background_color": "#F3F4F6",
      "chat_border_color": "#D1D5DB",
      "avatar_url": "https://example.com/avatar.png",
      "chat_icon_url": "https://example.com/icon.png",
      "agent_balloon_bg_color": "#DBEAFE",
      "agent_balloon_text_color": "#1F2937",
      "user_balloon_bg_color": "#1E40AF",
      "user_balloon_text_color": "#FFFFFF"
    },
    "typography": {
      "subtitle_message": "How can I help you today?",
      "greeting_message": "Hello! Welcome to our support.",
      "placeholder_input_message": "Type your message here..."
    }
  },
  "integrations": {
    "whats_app": [
      {
        "phone_number": "+551199999999",
        "status": "validated"
      }
    ]
  },
  "knowledge_base": [
    {
      "folder_id": "550e8400-e29b-41d4-a716-446655440000",
      "usage_instructions": "Use this folder for product documentation"
    }
  ]
}

Response

{
  "success": true,
  "message": "Assistant created successfully",
  "assistant": {
    "external_id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "Customer Support Bot",
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Get Assistants

Retrieves a paginated list of assistants for your organization.

Endpoint

GET /api/ai-hub/assistant

Query Parameters

  • page (optional): Page number (default: 1)
  • items_per_page (optional): Items per page (default: 10)
  • search (optional): Search term to filter assistants

Example Request

GET /api/ai-hub/assistant?page=1&items_per_page=10&search=support

Response

{
  "success": true,
  "assistants": [
    {
      "external_id": "550e8400-e29b-41d4-a716-446655440001",
      "name": "Customer Support Bot",
      "description": "AI assistant for handling customer inquiries",
      "created_at": "2024-01-15T10:30:00Z",
      "deployed_version": "v1.0.0"
    }
  ],
  "total_items": 25,
  "page": 1,
  "items_per_page": 10,
  "total_pages": 3
}

Get Assistant by ID

Retrieves detailed information about a specific assistant.

Endpoint

GET /api/ai-hub/assistant/:external_id

URL Parameters

  • external_id: The unique identifier of the assistant

Example Request

GET /api/ai-hub/assistant/550e8400-e29b-41d4-a716-446655440001

Response

{
  "success": true,
  "assistant": {
    "external_id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "Customer Support Bot",
    "description": "AI assistant for handling customer inquiries",
    "preferences": {
      "interface": {
        "header_background_color": "#1E40AF",
        "header_text_color": "#FFFFFF"
      },
      "typography": {
        "greeting_message": "Hello! Welcome to our support."
      }
    },
    "integrations": {
      "whats_app": [
        {
          "phone_number": "+551199999999",
          "status": "validated"
        }
      ]
    },
    "knowledge_base": [
      {
        "folder_id": "550e8400-e29b-41d4-a716-446655440000",
        "usage_instructions": "Use this folder for product documentation"
      }
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "created_by": "user_123",
    "deployed_version": "v1.0.0"
  }
}

Delete Assistants

Soft deletes one or more assistants.

Endpoint

DELETE /api/ai-hub/assistant

Request Body

{
  "external_ids": [
    "550e8400-e29b-41d4-a716-446655440001",
    "550e8400-e29b-41d4-a716-446655440002"
  ]
}

Response

{
  "success": true,
  "message": "2 assistants deleted successfully",
  "deleted_count": 2
}

Uploads a logo image for an assistant version.

Endpoint

POST /api/ai-hub/assistant/upload-logo

Request Type

Multipart form data

Form Fields

  • version_id (required): The version ID to associate the logo with
  • file (required): Image file (max 5MB)

Response

{
  "success": true,
  "message": "Logo uploaded successfully",
  "logo_url": "https://storage.example.com/logos/assistant-logo.png",
  "file_path": "/uploads/logos/assistant-logo.png"
}

File Requirements

  • Maximum file size: 5MB
  • Supported formats: PNG, JPG, JPEG, GIF, SVG
  • Recommended dimensions: 200x200px for best display