Integrations
Website Widgets
Embed an AI chat and a contact form on any website with a single line of code. All conversations are logged and accessible in the dashboard.
Widget types
Widget Chat
Floating button + chat panel. Users send messages and receive AI responses in real time.
Widget Form
Data collection form (name, email, phone, message) — for lead generation without an AI response.
Creating a widget
Go to Integrations → Add
Select the "Widgets" group and the "Widget Chat" type.
Configure the appearance
Set the position (bottom-right/left), button color, trigger label, and welcome message.
Save and copy the code
On the integration details page, click "Copy" in the "Embed code" block.
Embed code
HTML<!-- Insert before </body> -->
<script
src="https://your-domain.com/js/M-TEH-widget.js"
data-key="mth_abc123..."
data-pipeline="5"
data-pos="bottom-right"
data-color="#8b5cf6"
data-label="Assistant"
data-welcome="Hi! How can I help?"
data-api="https://your-domain.com"
></script>
Widget parameters
| Attribute | Type | Description | Default |
|---|---|---|---|
data-key | string | Required. M-TEH Key of your Widget integration | — |
data-pipeline | number | Pipeline ID. If omitted — uses the first available AI | auto |
data-pos | string | bottom-right or bottom-left | bottom-right |
data-color | hex | Button and accent color (#rrggbb) | #8b5cf6 |
data-label | string | Button aria-label | Chat |
data-welcome | string | First message from the assistant | Hi!… |
data-api | url | Base URL of the M-TEH (if different from the script domain) | auto |
How message delivery works
The widget sends a POST request to /api/chat of your M-TEH installation:
POST /api/chat{
"key": "mth_abc123...",
"session": "nx-a1b2c3...",
"message": "What's the price?",
"pipeline_id": 5
}
Response:
Response{
"reply": "Our plans start from $9/month...",
"session": "nx-a1b2c3...",
"tokens": 42
}
Sessions and conversation history
Each user gets a unique session_id stored in the browser's sessionStorage.
All messages are saved in the dialog_log table. History is passed to the AI in context — up to 20 recent
message pairs, providing conversation continuity.
View conversations in Pipelines → [Your Pipeline] → Dialogs.
You can also edit the system prompt based on real conversations.