---
title: "Chatbot Help Widget"
description: "Floating AI assistant for product questions and contacting NICE HMS support from any page on the website."
date: 2026-08-09
lastModified: 2026-08-15
category: "getting-started"
author: "Dr. Umesh Bilagi"
beta: false
---

## Overview

The chatbot widget is a floating help button that appears on every page of your NICE HMS website. Visitors can ask product questions and get instant AI-powered answers. If they need to reach a human, they can send a Contact Us message with their email and mobile directly from the chat — no login required.

For direct contact outside the chat widget, email **admin@nicehms.com** or call/WhatsApp **+919611560555**.

## Prerequisites

- The LangGraph chatbot server must be running and accessible at the `NEXT_PUBLIC_LANGGRAPH_URL` configured in your environment.
- `GOOGLE_GMAIL_USER` must be set in `.env` for the Contact Us email notification to work.
- Google Sheets integration (`GOOGLE_SHEET_SCRIPT_URL`) logs all contact form submissions.

## Workflow

### Asking questions

1. Click the **chat bubble icon** in the bottom-right corner of any page.
2. The chat panel opens showing "NICE HMS Help".
3. Type your question and press **Enter** or click **Send**.
4. The AI assistant streams its response in real time.
5. Click the **copy icon** under any message to copy its text to your clipboard.
6. Click **+ New** to start a fresh conversation.

### Sending an enquiry

To send an enquiry, request a demo, ask about pricing, or contact the NICE HMS team, use the **Contact Us** button right inside the chat widget. You do not need to send a separate email or fill out an external form.

1. Inside the chat panel, click the **Contact Us** button in the header.
2. A form card appears inside the chat with these fields:
   - **Email** — mandatory, your email address
   - **Mobile** — mandatory, your phone number with country code
   - **Your Message** — mandatory, describe your enquiry in detail (e.g. "I want a demo for my 20-bed hospital", "What's the pricing for the Clinic plan?", "I need help setting up ABDM")
3. Click **Send Message**.
4. You'll see a confirmation in the chat. The support team receives your enquiry by email and it is logged to Google Sheets. They will respond to you at the email or mobile you provided.

### Resizing the panel

Drag the **bottom-left corner** of the chat panel to resize it. On mobile, the panel opens full-screen.

## Escalating to the NICE HMS Team

The chat assistant should proactively offer to connect a user with the NICE HMS team whenever a conversation indicates the user needs human help. Escalate in any of these situations:

- The user asks about **pricing, plans, or wants a demo or trial**.
- The user wants to **buy, upgrade, or get a quote**.
- The user **reports a problem, bug, or outage** that staff must investigate or act on.
- The user explicitly **asks to speak to a human**, support, or sales.
- The assistant **cannot answer** the question, or the question falls outside the product documentation.
- The user expresses **frustration** or asks to be contacted.

When any of these apply, the assistant should:

1. Acknowledge the request or issue in a friendly tone.
2. Review the whole conversation and summarise every point the user raised into one clear message — do not rely only on the latest message.
3. Ask for their **Email** and **Mobile/phone** (with country code), and their name if you don't have it.
4. Submit the enquiry on their behalf, so the user does not need to leave the chat or fill out a form.

The user can also submit an enquiry themselves at any time by clicking the **Contact Us** button in the chat header and filling in their **Email**, **Mobile**, and **Message**. Either way, the enquiry is emailed to the team and logged to Google Sheets, and the team responds at the email or mobile the user provided.

### When the docs don't have the answer

If the user asks something the documentation does not cover, the assistant should:

1. Be honest that the information isn't in the docs.
2. Ask the user to describe what documentation they would like added — the topic and what they need.
3. Offer to submit that documentation request to the team on their behalf.

The documentation request goes through the same contact flow, so the team can prioritise writing the missing docs.

## Using the Contact API Directly

The Contact Us form submits to `/api/org/contact`. External chatbots, automation tools, or custom integrations can POST to this same endpoint. The API logs to Google Sheets and sends an email notification — no auth required. The endpoint returns CORS headers (`Access-Control-Allow-Origin: *`) and handles `OPTIONS` preflight, so browser-based tools and external agents can call it directly from the client.

```bash
curl -X POST {{NEXT_PUBLIC_BASE_URL}}/api/org/contact \
  -H "Content-Type: application/json" \
  -d '{
    "firstname": "John Doe",
    "email": "john@example.com",
    "phone": "+919876543210",
    "message": "I want a demo for my 20-bed hospital",
    "pagePath": "/pricing",
    "submittedAt": "2026-08-09T10:30:00.000Z"
  }'
```

| Field | Required | Notes |
|-------|----------|-------|
| `firstname` | Yes (for sheet log) | Falls back to email if blank |
| `email` | Yes | Contact email address |
| `phone` | Yes | Mobile number with country code |
| `message` | Yes | Enquiry description |
| `pagePath` | No | Page the enquiry came from |
| `submittedAt` | No | ISO timestamp |
| `lastname` | No | Optional last name |
| `company` | No | Optional company name |

The API also accepts a legacy email format with `subject`, `text`, `html`, `from`, `fromName` fields for direct email sending.

## AI Agent Discovery (`agent.json`)

NICE HMS publishes an agent discovery card at `/.well-known/agent.json`. This is an A2A-style description that lets external AI agents (assistants, copilots, or other chatbots) discover the NICE HMS help assistant and invoke it programmatically — no manual API wiring required.

The card describes:

- **Name**: NICE HMS Chat Agent
- **Invoke endpoint**: `POST {NEXT_PUBLIC_LANGGRAPH_URL}/invoke` — send a conversation and get a single reply.
- **Stream endpoint**: `POST {NEXT_PUBLIC_LANGGRAPH_URL}/runs/stream` — stream a reply in real time.
- **Capabilities**: streaming enabled.
- **Authentication**: none (open access).
- **Input schema**: `messages` (OpenAI chat format) plus optional `source`, `org`, `email`, and `user_id` for analytics.

An external agent reads the card to learn the endpoints and payload shape, then calls the invoke or stream endpoint directly. Both endpoints point at the same LangGraph server the on-page chat widget uses.

## Common Issues

- **"Sorry, something went wrong" error**: The LangGraph server may be unreachable. Check that `NEXT_PUBLIC_LANGGRAPH_URL` is correctly set in your environment.
- **No response from assistant**: Verify the LangGraph server is running and the `chatbot` assistant is deployed.

## FAQ

**Q: How do I send an enquiry or contact the NICE HMS team?**
A: Click the **Contact Us** button at the top of this chat widget, fill in your email, mobile, and message, then click **Send Message**. The team will get back to you.

**Q: Who can use the chat widget?**
A: Anyone visiting your website — patients, staff, or prospective customers. No login is needed.

**Q: Where do Contact Us messages go?**
A: They are logged to Google Sheets (under the "contact" type) and an email is sent to the address configured in `GOOGLE_GMAIL_USER`.

**Q: Does the chat remember previous conversations?**
A: Yes. A thread ID is stored in your browser's local storage so the assistant maintains context across sessions. Click **+ New** to reset it.

**Q: Is my data secure?**
A: The chat widget streams responses directly from your LangGraph server (configured via `NEXT_PUBLIC_LANGGRAPH_URL`). Messages are sent to that server only, not to unrelated third parties.
