> For the complete documentation index, see [llms.txt](https://docs.xenoraa.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xenoraa.com/xenoraa-tenant-onboarding-guide/xena-ai-and-chatgpt-integration.md).

# Xena AI & ChatGPT Integration

## Xena AI & ChatGPT Integration 🤖

**Xena AI** is your conversational business analyst and assistant, embedded directly inside your Xenoraa workspace. Powered by ChatGPT Actions, Xena AI allows you to query your live business data, update CRM records, generate sales forecasts, and draft customer communications using simple, natural language.

***

### 💬 What is Xena AI?

Unlike generic AI chatbots, Xena AI has **secure, direct, and real-time access** to your specific tenant database. It can read your database schema, call pre-defined business tools, and perform actions on your behalf — all while strictly respecting tenant data isolation.

```
[ You ] ------------(Natural Language)------------> [ Xena AI Drawer / Custom GPT ]
                                                           |
                                                   (Calls Secure API)
                                                           v
[ Database ] <-----(Isolated by Tenant ID)----- [ Xenoraa Actions API ]
```

***

### 👤 Step-by-Step Setup Walkthrough

#### 1. Generating Your Xena API Token

To connect a Custom GPT or external AI client to your Xenoraa workspace, you must generate a secure API token.

* Navigate to `Settings > ChatGPT Integration` or `admin/xena/chatgpt-token`.
* Click the **Generate Token** button.
* Give your token a descriptive name (e.g., *My Business Assistant GPT*).
* Click **Generate**.
* **Copy the Token Immediately:** For security, the full token (starting with `xr_live_`) is only displayed once. Store it securely.

#### 2. Accessing Xena AI inside Xenoraa

You don't need any external tools to start chatting with Xena.

* Click the floating **Xena AI Icon** in the bottom-right corner of your dashboard.
* The Xena Chat Drawer will slide open.
* **Auto-Resume:** The drawer automatically remembers your last conversation, allowing you to pick up right where you left off. Click **+ New Chat** at the top of the drawer to clear the history and start fresh.

#### 3. Connecting the Custom GPT (ChatGPT Plus Users)

If you have a ChatGPT Plus subscription, you can interact with Xenoraa directly from the ChatGPT interface using our private Custom GPT.

* Go to the **Xenoraa Business Assistant Custom GPT** (GPT ID: `g-6a4cfc6ff2508191a764cd96b3d71edd`).
* On your first prompt, ChatGPT will ask for your API Token.
* Paste your token (`xr_live_...`) to authorize the connection.
* ChatGPT will now have access to your live Xenoraa data via the OpenAPI Actions schema.

***

### 💡 What Can You Ask Xena AI?

Xena AI is equipped with **166 specialized business tools** across all modules. Here are some real-world prompts you can use:

#### 📊 Conversational Business Intelligence

* *"How many leads did we capture this week, and what is our close rate?"*
* *"Give me a summary of our POS sales for today by product category."*
* *"What is our total outstanding accounts receivable (unpaid invoices)?"*
* *"Show me our month-by-month e-commerce revenue trend for the last 6 months."*

#### ✍️ CRM Updates & Task Automation

* *"Create a new lead named Rajesh Kumar, email <rajesh@example.com>, company RK Exports, deal value Rs. 50,000."*
* *"Update the status of Rajesh Kumar's lead to 'Contacted' and add a note saying we scheduled a demo for Thursday."*
* *"Create a high-priority todo task to follow up on the wholesale price book updates by tomorrow."*
* *"Close support case #1024 and set the resolution to 'Resolved after server reboot'."*

#### 💰 Financial Bookkeeping & Records

* *"List our recent bank transfers."*
* *"Record an expense of Rs. 4,500 for office internet paid today from our HDFC bank account."*
* *"Create a wholesale price book offering a 15% discount on all electronics products."*

***

### 🔒 Security & Data Privacy

* **Tenant Isolation:** Xena AI is strictly bounded by your API token. It can *never* access data belonging to other Xenoraa tenants.
* **Audit Logs:** All actions performed by Xena AI are logged under your user profile in the system audit logs.
* **Token Revocation:** If you ever lose your API token or suspect it has been compromised, navigate to `Settings > ChatGPT Integration` and click **Revoke** next to the token. This instantly blocks all external API access.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.xenoraa.com/xenoraa-tenant-onboarding-guide/xena-ai-and-chatgpt-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
