Copilot widget
How to embed the widget
Learn how to embed the copilot in your app
the chat widget enables you to interact with the Copilot from your dashboard and see the changes in realtime. OpenCopilot is a react web app that you can embed in your app.
there are several ways you can integrate the Copilot Chat widget into your application/webpage
Using simple js script (recommended)
-
Download the latest build from GitHub and extract the zip file.
-
Include the provided JavaScript file in the head of your document (use
http://localhost:8888/pilot.js
for local setup). -
Init the copilot (when document fully loads) by calling the
initAiCoPilot
function and passing the required options.
As a React Component
-
Install the widget from npm.
-
Use the Component inside your application
Options
Options
Object
Available options
Option | Description | type |
---|---|---|
initialMessage | The message that will be first present when the copilot is initialized | string |
token | Your copilot token | string |
triggerSelector | The selector of the element that will trigger the copilot when clicked | string |
apiUrl | the url of the copilot api. | string |
headers | An object of headers that will be sent with every request (can be used to authenticate your api requests) | Record<string,string> |
containerProps | An object of props that will be passed to the container div | Record<string,string> |
socketUrl | The url of the socket url that will be used to send and receive messages | string |