feat: allow adding custom attributes to conversations from the SDK (#6782)
* feat: add conversation attributes method to sdk and widget app * feat: add endpoints to update custom attributes * refactor: update SDK api * feat: add api and actions for conversation updates * fix: error message * test: custom attributes on conversations controller --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
@@ -114,6 +114,26 @@ const runSDK = ({ baseUrl, websiteToken }) => {
|
||||
}
|
||||
},
|
||||
|
||||
setConversationCustomAttributes(customAttributes = {}) {
|
||||
if (!customAttributes || !Object.keys(customAttributes).length) {
|
||||
throw new Error('Custom attributes should have atleast one key');
|
||||
} else {
|
||||
IFrameHelper.sendMessage('set-conversation-custom-attributes', {
|
||||
customAttributes,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
deleteConversationCustomAttribute(customAttribute = '') {
|
||||
if (!customAttribute) {
|
||||
throw new Error('Custom attribute is required');
|
||||
} else {
|
||||
IFrameHelper.sendMessage('delete-conversation-custom-attribute', {
|
||||
customAttribute,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setLabel(label = '') {
|
||||
IFrameHelper.sendMessage('set-label', { label });
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user