@@ -5,21 +5,43 @@ Plain.init({
55 // Optional. Hides the launcher, you can manually show it by calling `Plain.open()` (default: false)
66 hideLauncher: false ,
77
8- // Optional. The title of the chat window shown on the Welcome screen
9- title: ' Chat with us' ,
10-
118 // Optional. A collection of links shown on the Welcome screen
129 links: [
1310 {
14- icon: ' book' , // Optional, we also support 'discord' and 'slack' as icons
11+ // Optional, supported icons are:
12+ // 'bell',
13+ // 'book',
14+ // 'bug',
15+ // 'bulb',
16+ // 'chat',
17+ // 'integration',
18+ // 'discord',
19+ // 'email',
20+ // 'slack',
21+ // 'link',
22+ // 'pencil',
23+ // 'send',
24+ // 'support',
25+ // 'error'
26+ icon: ' book' ,
1527 text: ' View our docs' ,
1628 url: ' https://www.plain.com/docs' ,
1729 },
1830 ],
1931
20- // Optional. The entry point of the Chat, is either 'default' or 'chat'
21- // 'chat' will open the last conversation the user had (default: 'default')
22- entryPoint: ' default' ,
32+ // Optional. The entry point of the Chat.
33+ entryPoint: {
34+ // Type is either 'default' or 'chat'. 'default' will open the intro screen, 'chat' opens up straight into a chat.
35+ type: ' chat' ,
36+ // Optional. The external ID of which chat to open. If not provided it will default to the last conversation the user had
37+ externalId: ' example_external_id' ,
38+ // Optional. Prevents the user from going back to the intro screen to start a new chat
39+ singleChatMode?: false ,
40+ },
41+
42+ // Optional. Lets you specify which HTML element to insert the chat into.
43+ // When specified, launcher will be hidden by default.
44+ embedAt: ' #embed' ,
2345
2446 // Optional. The color scheme of the Chat, is either 'auto', 'light', or 'dark'
2547 // 'auto' uses the user's browser preference to decide between light and dark mode (default: 'auto')
@@ -28,8 +50,80 @@ Plain.init({
2850 // Optional. Various styling options
2951 // Colors can also be passed in this format { light: '#FFFFFF', dark: '#000000' }. Based on the theme chosen by you or browser preference
3052 style: {
31- chatButtonColor : ' #000000' ; // These can also be passed in this foramt { light: '#FFFFFF', dark: '#000000' }
32- chatButtonIconColor : ' #FFFFFF' ;
53+ launcherBackgroundColor : ' #000000' ; // These can also be passed in this format { light: '#FFFFFF', dark: '#000000' }
54+ launcherIconColor : ' #FFFFFF' ;
3355 }
56+
57+ // Optional. Logo which is shown in the header of the chat intro screen
58+ logo : {
59+ // url to get the logo from
60+ url: ' http://example.com' ;
61+ // Optional. Alt text which is displayed on hover of the logo
62+ alt : ' An example logo' ;
63+ };
64+
65+ // Optional. Allows you to set fields for the threads which are created from chats
66+ threadDetails : {
67+
68+ // Optional. Labels to be set on created threads.
69+ // To find a label id open the Plain app and go to 'Settings' -> 'Labels', you can select `Copy label ID` from the overflow menu on each label
70+ labelTypeIds: [' lt_01JDAB92EBHP3DSXS43DW96WBS' ],
71+
72+ // Optional. A tier to be set on created threads.
73+ // To find a tier ID open the Plain app and go to 'Settings' -> 'Tiers'. Select a tier and then copy the ID from the URL.
74+ // You can also specify a tier by its external ID e.g { externalId: 'example_external_id' }
75+ tierIdentifier: { tierId: ' tier_01JDABCAZBDFKH7WA6WNBDSA2F' },
76+
77+ // Optional. A tenant to be set on created threads.
78+ // To find a tenant ID open the Plain app and click 'Tenants' under 'Browse' in the left sidebar. Select a tenant and then copy the ID from the URL.
79+ // You can also specify a tenant by its external ID e.g { externalId: 'example_external_id' }
80+ tenantIdentifier: { tenantId: ' te_01HT539973HNVZFSDXWHPT8FH1' },
81+
82+ // Optional. An external ID to be set on created threads.
83+ externalId: ' example_external_id' ;
84+ };
85+
86+ // Optional. Lets you customize the buttons which are used to start a new chat on the intro screen
87+ chatButtons : [
88+ {
89+ // Optional. The name of the icon to display, see above for full options
90+ icon: ' bulb' ,
91+
92+ // The text to display on the button
93+ text: ' Give feedback' ,
94+
95+ // Optional. Allows you to set fields for the threads which are created with this button. See above for full options.
96+ threadDetails: {};
97+
98+ // Optional. Form elements which the user must fill out before sending a chat message
99+ form : {
100+
101+ // The fields which make up the form. All form fields must be filled in for a user to send a chat message
102+ fields: [
103+ {
104+ // Currently only dropdown form fields are supported
105+ type: ' dropdown' ,
106+
107+ // Optional. The placeholder text displayed on the dropdown
108+ placeholder: ' Select a topic...' ,
109+
110+ // The options which are available in the dropdown, minimum of 1 required.
111+ options: [
112+ {
113+ // Optional. An icon to be displayed on the dropdown option. See above for full options.
114+ icon: ' bug' ,
115+
116+ // The text which is displayed for this dropdown option
117+ text: ' Bug report' ,
118+
119+ // Optional. Enables setting values on threads when this option is selected by the user. See above for full options
120+ threadDetails: {},
121+ }
122+ ],
123+ }
124+ ]
125+ },
126+ }
127+ ];
34128});
35129```
0 commit comments