Skip to main content

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)​

ParameterTypeRequiredDescription
appIdstringYesYour unique application identifier (Client ID)
placementstringNoWidget button position. Default: bottom-left

Available placement Values​

ValueDescription
bottom-rightBottom-right corner
bottom-leftBottom-left corner (default)
top-rightTop-right corner
top-leftTop-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',
});
ParameterTypeDescription
usernamestringUser email or username
externalIdstringUser'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',
});
ParameterTypeDescription
hashstringTransaction hash or address
networkstringBlockchain network identifier

Supported Networks​

ValueNetwork
btcBitcoin
ethEthereum
bscBNB Chain
trxTron
maticPolygon
arbArbitrum
baseBase
avaxAvalanche
opOptimism

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​

  1. The embed.js script creates a circular toggle button at the specified position.
  2. Clicking the button opens an iframe with the AMLBot application.
  3. Communication between your site and the widget uses the postMessage API.
  4. Commands called before the widget is ready are automatically queued and executed once it loads.