@rechat/sdk
v0.2.12
Published
Rechat SDK library allows you to integrate your website or application with Rechat.
Downloads
227
Readme
Rechat SDK library allows you to integrate your website or application with Rechat.
[[include:Installation.md]]
Basic Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/@rechat/sdk@latest/dist/rechat.min.js"></script>
</head>
<body>
<button id="capture-1">Lead Capture</button>
<script>
const sdk = new Rechat.Sdk()
const channel = {
lead_channel: '2c55e69d-adbe-42d9-97a5-bedb43783b80'
}
const input = {
first_name: 'John',
last_name: 'Doe',
email: '[email protected]',
phone: '+18189191212',
}
document.getElementById('capture-1').addEventListener('click', () => {
sdk.Leads.capture(channel, input)
.then(() => {
console.log('Done')
})
.catch((e) => {
console.log('Error:', e)
})
})
</script>
</body>
</html>