@datclaw/widget
v1.0.2
Published
Embeddable chat widget for Datclaw agents
Readme
@datclaw/widget
Embeddable chat widget for Datclaw agents.
Install
npm install @datclaw/widgetUsage
Programmatic (npm)
import DatclawWidget from '@datclaw/widget'
DatclawWidget.init({
publicKey: 'wpk_...',
apiBase: 'https://api.datclaw.com', // optional in production
})Script tag (UMD)
<script src="node_modules/@datclaw/widget/dist/widget.v1.js"></script>
<script>
DatclawWidget.init({
publicKey: 'wpk_...',
apiBase: 'http://localhost:8000'
})
</script>Or with data attributes:
<script
src="node_modules/@datclaw/widget/dist/widget.v1.js"
data-public-key="wpk_..."
data-api-base="http://localhost:8000"
async
></script>API
| Method | Description |
|--------|-------------|
| init({ publicKey, apiBase? }) | Mount the chat bubble |
| identify({ email?, phone?, custom_id? }) | Attach end-user identity |
| open() | Open the chat window |
| close() | Close the chat window |
| destroy() | Remove the widget from the page |
