feat: Custom Attributes for contacts (#1158)

Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
This commit is contained in:
Sojan Jose
2020-08-21 19:30:27 +05:30
committed by GitHub
parent 507b40a51d
commit cdd385b269
18 changed files with 182 additions and 21 deletions

View File

@@ -66,6 +66,31 @@ window.$chatwoot.setUser('identifier_key', {
Make sure that you reset the session when the user logs out of your app.
### Set custom attributes
Inorder to set additional information about the customer you can use customer attributes field.
To set a custom attributes call `setCustomAttributes` as follows
```js
window.$chatwoot.setCustomAttributes({
accountId: 1,
pricingPlan: 'paid',
// You can pass any key value pair here.
// Value should either be a string or a number.
// You need to flatten nested JSON structure while using this function
});
```
You can view these information in the sidepanel of a conversation.
To delete a custom attribute, use `deleteCustomAttribute` as follows
```js
window.$chatwoot.deleteCustomAttribute('attribute-name');
```
### To set language manually
```js