The Form widget is available through our CDN as a single JavaScript file or through NPM as a React component package.
HTML
React
<script type="module">import Form from 'https://cdn.sonian.ai/embeded/latest/form/index.js';Form.initStandard({formId: 'YOUR_FORM_ID',});</script>
Attributes / Props
HTML
React
<script type="module">import Form from 'https://cdn.sonian.ai/embeded/latest/form/index.js';Form.initStandard({formId: 'YOUR_AGENT_ID',onEnd: function (values) {console.log('Form submitted with values:', values);},})</script>
string
required
ID of the Agent
function
Callback function that is called when the form is submitted. The function receives the form values as an object.
const form = await Form.initBubble({ agentId: 'YOUR_AGENT_ID', onEnd: function (values) { console.log('Form submitted with values:', values); },})