Plain.init({
appId: 'your_chat_app_id_here',
// Optional. Hides the launcher, you can manually show it by calling `Plain.open()` (default: false)
hideLauncher: false,
// Optional. A collection of links shown on the Welcome screen
links: [
{
// Optional, supported icons are:
// 'bell',
// 'book',
// 'bug',
// 'bulb',
// 'chat',
// 'integration',
// 'discord',
// 'discord_muted',
// 'email',
// 'slack',
// 'slack_muted',
// 'link',
// 'pencil',
// 'send',
// 'support',
// 'error'
icon: 'book',
text: 'View our docs',
url: 'https://www.plain.com/docs',
},
],
// Optional. The entry point of the Chat.
entryPoint: {
// Type is either 'default' or 'chat'. 'default' will open the intro screen, 'chat' opens up straight into a chat.
type: 'chat',
// Optional. The external ID of which chat to open. If not provided it will default to the last conversation the user had.
externalId: 'example_external_id',
// Optional. Prevents the user from going back to the intro screen to start a new chat.
singleChatMode: false,
},
// Optional. Lets you specify which HTML element to insert the chat into.
// When specified, launcher will be hidden by default.
// Note: this must be a DOM Element, not a CSS selector string.
embedAt: document.querySelector('#embed'),
// Optional. Hides the 'Powered by Plain' branding
hideBranding: false,
// Optional. The color scheme of the Chat, is either 'auto', 'light', or 'dark'
// 'auto' uses the user's browser preference to decide between light and dark mode (default: 'auto')
theme: 'light',
// Optional. Various styling options
// Colors can also be passed in this format { light: '#FFFFFF', dark: '#000000' }. Based on the theme chosen by you or browser preference
style: {
brandColor: '#22C55E', // This will be used in various places in the chat widget such as the primary chat button and send message button
brandBackgroundColor: '#22C55E', // Used for the background of the chat widget on the intro screen
launcherBackgroundColor: '#000000', // These can also be passed in this format { light: '#FFFFFF', dark: '#000000' }
launcherIconColor: '#FFFFFF',
},
// Optional. Logo which is shown in the header of the chat intro screen.
// If you have uploaded a logo in your chat settings, this setting will take priority over that.
logo: {
// url to get the logo from
url: 'http://example.com',
// Optional. Alt text which is displayed on hover of the logo
alt: 'An example logo',
},
// Optional. Position of the chat widget when it is floating.
// See https://developer.mozilla.org/en-US/docs/Web/CSS/position for more information - only bottom, right, and zIndex are supported
position: {
right: '10px',
bottom: '10px',
zIndex: '1000', // Optional. Controls the stacking order of the widget
},
// Optional. Allows you to set fields for the threads which are created from chats
threadDetails: {
// See the data model documentation for more information on these fields
},
// Optional. Lets you customize the buttons which are used to start a new chat on the intro screen
chatButtons: [
// See the chat buttons documentation for more information on these fields
],
});