Skip to main content

Chat widgets

Base URL https://api.leadx.in/api/key/protected. Every request needs an apikey header — see Authentication.

9 endpoints.

GET /chat-widget

Get all chat widgets.

Auth apikey

:::note Used by the web app components/ChatWidgetTemplatesModal.jsx, pages/AddChatWidget.jsx, pages/ChatWidgets.jsx :::

Query parameters — the standard list contract: p, n, sortBy, sortOrder, searchBy, searchValue, filters, advancedFilters, ids, nids. See Pagination and Filtering.

Responsedata is an array of ChatWidget objects, alongside the pagination fields described in Response format. updatedBy, createdBy are populated, so they arrive as nested objects rather than ids.

POST /chat-widget

Create chat widget.

Auth apikey · Success 200

:::note Used by the web app components/ChatWidgetTemplatesModal.jsx, pages/AddChatWidget.jsx, pages/ChatWidgets.jsx :::

Request body

FieldDefault
name
description
preChat
appearance
behaviour
verification
allowedDomains
status

Required: name.

Responsedata is one ChatWidget object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

Errors ChatWidgetNameAlreadyExists_400

DELETE /chat-widget

Delete chat widget.

Auth apikey · Success 200

:::note Used by the web app components/ChatWidgetTemplatesModal.jsx, pages/AddChatWidget.jsx, pages/ChatWidgets.jsx :::

Request body

FieldDefaultNotes
ids[]Documents to act on.

Responsedata is one ChatWidget object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

Errors NoChatWidgetSelected_400

GET /chat-widget/:id

Get chat widget.

Auth apikey

:::note Used by the web app pages/AddChatWidget.jsx :::

Path parameters

Name
idRequired

Responsedata is one ChatWidget object. createdBy updatedBy is populated, so it arrives as nested objects rather than ids.

Errors ChatWidgetNotFound_400

PUT /chat-widget/:id

Update chat widget.

Auth apikey · Success 200

:::note Used by the web app pages/AddChatWidget.jsx :::

Path parameters

Name
idRequired

Responsedata is one ChatWidget object.

Errors ChatWidgetNameAlreadyExists_400 · ChatWidgetNotFound_400

PUT /chat-widget/:id/rotate-token

Rotate a widget's public embed token.

Auth apikey · Success 200

:::note Used by the web app pages/AddChatWidget.jsx :::

Path parameters

Name
idRequired

Responsedata is one ChatWidget object.

Errors ChatWidgetNotFound_400

GET /chat-widget/:id/sessions

Get chat widget sessions.

Auth apikey

:::note Used by the web app pages/AddChatWidget.jsx :::

Path parameters

Name
idRequired

Query parameters — the standard list contract: p, n, sortBy, sortOrder, searchBy, searchValue, filters, advancedFilters, ids, nids. See Pagination and Filtering.

Responsedata is an array of ChatWidgetSession objects, alongside the pagination fields described in Response format. contact is populated, so it arrives as nested objects rather than ids.

Errors ChatWidgetNotFound_400

PUT /chat-widget/:id/status

Set chat widget status.

Auth apikey · Success 200

Path parameters

Name
idRequired

Request body

FieldDefault
status

Responsedata is one ChatWidget object.

Errors ChatWidgetNotFound_400

PUT /chat-widget/session/:sessionId/intercept

Intercept chat widget session.

Auth apikey · Success 200

:::note Used by the web app components/ChatWindow.jsx :::

Path parameters

Name
sessionIdRequired

Responsedata is one ChatWidgetSession object.

Errors ChatWidgetNotFound_400