-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chat doc updates to cover chat buttons, forms, brand color
- Loading branch information
Showing
9 changed files
with
141 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
```typescript | ||
Plain.init({ | ||
// ...Other options | ||
|
||
chatButtons: [{ | ||
{ | ||
// Optional. The name of the icon to display, see above for full options | ||
icon: 'bulb', | ||
|
||
// The text to display on the button | ||
text: 'Give feedback', | ||
|
||
// Optional. Allows you to set fields for the threads which are created with this button. See above for full options. | ||
threadDetails: {}; | ||
|
||
// Optional. Form elements which the user must fill out before sending a chat message. See below for full options. | ||
form: {}, | ||
} | ||
}] | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
```typescript | ||
|
||
Plain.init({ | ||
// ...Other options | ||
chatButtons: [{ | ||
{ | ||
// ...Other chat button options | ||
form: { | ||
// The fields which make up the form. All form fields must be filled in for a user to send a chat message | ||
fields: [ | ||
{ | ||
// Currently only dropdown form fields are supported | ||
type: 'dropdown', | ||
|
||
// Optional. The placeholder text displayed on the dropdown | ||
placeholder: 'Select a topic...', | ||
|
||
// The options which are available in the dropdown, minimum of 1 required. | ||
options: [ | ||
{ | ||
// Optional. An icon to be displayed on the dropdown option. See above for full options. | ||
icon: 'bug', | ||
|
||
// The text which is displayed for this dropdown option | ||
text: 'Bug report', | ||
|
||
// Optional. Enables setting values on threads when this option is selected by the user. See above for full options | ||
threadDetails: {}, | ||
} | ||
], | ||
} | ||
] | ||
}, | ||
} | ||
}] | ||
}) | ||
|
||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
```typescript | ||
Plain.init({ | ||
// ...Other options | ||
|
||
threadDetails: { | ||
// Optional. Labels to be set on created threads. | ||
// 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 | ||
labelTypeIds: ['lt_01JDAB92EBHP3DSXS43DW96WBS'], | ||
|
||
// Optional. A tier to be set on created threads. | ||
// 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. | ||
// You can also specify a tier by its external ID e.g { externalId: 'example_external_id' } | ||
tierIdentifier: { tierId: 'tier_01JDABCAZBDFKH7WA6WNBDSA2F' }, | ||
|
||
// Optional. A tenant to be set on created threads. | ||
// 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. | ||
// You can also specify a tenant by its external ID e.g { externalId: 'example_external_id' } | ||
tenantIdentifier: { tenantId: 'te_01HT539973HNVZFSDXWHPT8FH1' }, | ||
|
||
// Optional. An external ID to be set on created threads. | ||
externalId: 'example_external_id'; | ||
} | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: 'Customization' | ||
--- | ||
|
||
## General customization | ||
|
||
You can customize the chat widget to match your brand and user experience. You can change various aspects of the chat widget including both the appearance and behavior. | ||
|
||
<Accordion title="General customization code"> | ||
<Snippet file="chat/customization.mdx" /> | ||
</Accordion> | ||
|
||
## Enhance your chat flows with Plain’s data model | ||
|
||
Plain’s chat widget is designed to be flexible and powerful. You can use Plain’s data model to enhance your chat flows, providing a more tailored experience for your users and | ||
improving your ability to triage and respond. | ||
|
||
You can currently set the following fields on threads created from the chat widget: | ||
* Labels | ||
* Tiers | ||
* Tenants | ||
* External IDs | ||
|
||
There are several places in the configuration you can add these with varying effects: | ||
|
||
### All threads | ||
|
||
Providing a top-level `threadDetails` object in the `Plain.init` function will set these fields on all threads created from the chat widget. You could, for example, | ||
set a label based on the page the user is on. | ||
|
||
<Accordion title="Thread details code"> | ||
<Snippet file="chat/thread-details.mdx" /> | ||
</Accordion> | ||
|
||
### Chat buttons | ||
|
||
Aside from being able to customize the text and icon of the chat button, you can also provide a set of fields that will be set on the thread when the user clicks that specific button. | ||
|
||
You can add these by providing a `threadDetails` object to an item within `chatButtons` array. For example, you could add a button for users to report a bug, which would set a label on the thread to `Bug report`. | ||
|
||
<Accordion title="Chat buttons code"> | ||
<Snippet file="chat/chat-buttons.mdx" /> | ||
</Accordion> | ||
|
||
### Chat forms | ||
|
||
Similar to chat buttons, chat forms allow you to set fields on the thread when the user creates a chat. These are specific to each `chatButton`. | ||
|
||
<Accordion title="Chat forms code"> | ||
<Snippet file="chat/chat-forms.mdx" /> | ||
</Accordion> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.