Widget Integration
Quick Start
To embed the widget on your website, add a single JavaScript block to your HTML page.
Step 1. Configure and Load the Script
Insert the following code before the closing </body> tag (or anywhere inside <body>):
<script>
window.amlBotSettings = {
appId: 'YOUR_APP_ID',
placement: 'bottom-right',
};
(function (w, d, url) {
if (!w.AMLBotWidget) {
w.AMLBotWidget = function () {
w.AMLBotWidget.q.push(arguments);
};
w.AMLBotWidget.q = [];
}
function loadScript() {
if (d.querySelector('script[src="' + url + '"]')) return;
const s = d.createElement('script');
s.async = 1;
s.src = url;
const x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (d.readyState === 'complete') {
loadScript();
} else {
w.addEventListener('load', loadScript, false);
}
})(
window,
document,
'https://YOUR_WIDGET_DOMAIN/embed/v1/embed.js'
);
</script>
caution
Replace https://YOUR_WIDGET_DOMAIN with the actual domain where the widget is hosted.
Step 2. Initialize the Widget
After the page loads, call the init method with user data:
<script>
window.onload = () => {
window.AMLBotWidget('init', {
username: '[email protected]',
externalId: '12345678',
});
};
</script>
Once initialized, a circular toggle button will appear on the page to open/close the widget.
Configuration (amlBotSettings)
| Parameter | Type | Required | Description |
|---|---|---|---|
appId | string | Yes | Your unique application identifier (Client ID) |
placement | string | No | Widget button position. Default: bottom-left |
Available placement Values
| Value | Description |
|---|---|
bottom-right | Bottom-right corner |
bottom-left | Bottom-left corner (default) |
top-right | Top-right corner |
top-left | Top-left corner |
Widget API
Interact with the widget via the global function window.AMLBotWidget(method, params).
init — Initialize
Creates the widget on the page and registers the user.
window.AMLBotWidget('init', {
username: '[email protected]',
externalId: 'unique-user-id',
});
| Parameter | Type | Description |
|---|---|---|
username | string | User email or username |
externalId | string | User's external identifier in your system |
sendData — Submit Data for AML Check
Sends a transaction hash and network for verification.
window.AMLBotWidget('sendData', {
hash: '0xabc123...',
network: 'eth',
});
| Parameter | Type | Description |
|---|---|---|
hash | string | Transaction hash or address |
network | string | Blockchain network identifier |
Supported Networks
| Value | Network |
|---|---|
btc | Bitcoin |
eth | Ethereum |
bsc | BNB Chain |
trx | Tron |
matic | Polygon |
arb | Arbitrum |
base | Base |
avax | Avalanche |
op | Optimism |
open — Open the Widget
window.AMLBotWidget('open');
close — Close the Widget
window.AMLBotWidget('close');
toggle — Toggle Widget Visibility
window.AMLBotWidget('toggle');
Full Integration Example
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Website with AMLBot Widget</title>
</head>
<body>
<h1>Welcome</h1>
<p>Your website content...</p>
<script>
window.amlBotSettings = {
appId: 'YOUR_APP_ID',
placement: 'bottom-right',
};
(function (w, d, url) {
if (!w.AMLBotWidget) {
w.AMLBotWidget = function () {
w.AMLBotWidget.q.push(arguments);
};
w.AMLBotWidget.q = [];
}
function loadScript() {
if (d.querySelector('script[src="' + url + '"]')) return;
const s = d.createElement('script');
s.async = 1;
s.src = url;
const x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (d.readyState === 'complete') {
loadScript();
} else {
w.addEventListener('load', loadScript, false);
}
})(
window,
document,
'https://YOUR_WIDGET_DOMAIN/embed/v1/embed.js'
);
</script>
<script>
window.onload = () => {
window.AMLBotWidget('init', {
username: '[email protected]',
externalId: '12345678',
});
};
</script>
</body>
</html>
How It Works
- The
embed.jsscript creates a circular toggle button at the specified position. - Clicking the button opens an iframe with the AMLBot application.
- Communication between your site and the widget uses the
postMessageAPI. - Commands called before the widget is ready are automatically queued and executed once it loads.