Using Webchat SDK
Last updated
Last updated
Webchat SDK allows you to embed your Amity chatbot into your website. This provides a customized chat experience for visitors right on your site.
Go to Channels menu in your Amity Bots Platform page and add a new Webchat channel with the channel name. Once added, click on the newly-created channel, the following popup should appear:
Record your channel ID to be used in the next step
Include the SDK file in your page:
Initialize the chat with required parameters:
This will load the chat in a full screen overlay when .load
is triggered.
When initializing Webchat SDK you can specifiy 2 modes: fullscreen
or bubble
Full screen mode displays the webchat interface in a full page overlay. This can be useful if you want to navigate your user directly to the fullscreen webchat from other page or use Webchat SDK in a Webview inside a native mobile application.
Bubble mode displays a small circular chat button that opens a widget.
The richmenuSetting
controls the height of the rich menu area. There are 3 options:
Default - Automatically sizes based on the window width. This divides the full window width by 1.6667. For example, on a 300px wide window it will be 1000 / 1.6667 = 180px high.
fixedHeight - Sets an absolute fixed height in pixels. For example:
dividedBy - Makes the height responsive. It takes the default width divided by 1.6667 and divides it again by this number.
On our 300px width container, the default is 180px high. With dividedBy: 2
, height of richmenu is 300 / 1.6667 / = 150px
dividedBy
makes the rich menu responsively scale down on smaller screens.
Note: Only use fixedHeight
OR dividedBy
, not both. fixedHeight
overrides dividedBy
if set.