Install the Widget
Get the Plucky chat widget running on your site in under 5 minutes.
1. Create an App
First, create an app at platform.plucky.ai (or your given instance). You'll get an App ID that you'll use in the next step.
2. Add the Widget
Choose your installation method:
- Script Tag
- NPM
Add this snippet to your HTML, just before the closing </body> tag:
<script>
window.pluckySettings = {
baseUrl: 'https://widget.plucky.ai',
appId: 'YOUR_APP_ID',
user: {
id: 'user_123',
name: 'Jane Smith',
email: '[email protected]',
},
}
</script>
<script>
;(function () {
var w = window
var ic = w.Plucky
if (typeof ic === 'function') {
ic('update', w.pluckySettings)
} else {
var d = document
var i = function () {
i.c(arguments)
}
i.q = []
i.c = function (args) {
i.q.push(args)
}
w.Plucky = i
var l = function () {
var s = d.createElement('script')
s.type = 'text/javascript'
s.async = true
s.src =
(window.pluckySettings.baseUrl || 'https://widget.plucky.ai') +
'/loader/' +
window.pluckySettings.appId
var x = d.getElementsByTagName('script')[0]
x.parentNode.insertBefore(s, x)
}
if (document.readyState === 'complete') {
l()
} else if (w.attachEvent) {
w.attachEvent('onload', l)
} else {
w.addEventListener('load', l, false)
}
}
})()
</script>
Install the SDK:
npm install @plucky-ai/chat-sdk
Then initialize the widget in your app:
import { Plucky } from '@plucky-ai/chat-sdk'
Plucky({
baseUrl: 'https://widget.plucky.ai',
appId: 'YOUR_APP_ID',
user: {
id: 'user_123',
name: 'Jane Smith',
email: '[email protected]',
},
})
3. Test It
Refresh your page. You should see a chat bubble in the bottom-right corner. Click it and send a message — the AI will respond.
You're done!
The widget is now installed. Next, let's add a tool so the AI can interact with your app.
Configuration Options
| Property | Type | Required | Description |
|---|---|---|---|
appId | string | Yes | Your App ID from the Plucky platform |
baseUrl | string | Yes | Widget server URL (typically https://widget.plucky.ai) |
user | object | No | User identification (see below) |
User Object
| Property | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique identifier for the user |
name | string | No | Display name |
email | string | No | Email address |
createdAt | string | No | ISO 8601 timestamp |
metadata | object | No | Custom key-value data |