### startService Source: https://sdk.usedocs.com/article/26498 Starts the notification service. ```APIDOC ## startService(context: Context) ### Description Starts the chat notification service. ### Parameters - **context** (Context) - Required - The application or activity context. ### Example ```kotlin usedeskChat.startService(requireContext()) ``` ``` -------------------------------- ### Start Notification Service Source: https://sdk.usedocs.com/article/26498 Starts the notification service using the provided context. ```kotlin usedeskChat.startService(requireContext()) ``` -------------------------------- ### InputLayout Style Example Source: https://sdk.usedocs.com/article/26495 Example of a style identifier for an InputLayout-based element. ```text Usedesk.Chat.Screen.Offline.Form.Email.InputLayout ``` -------------------------------- ### Image Style Example Source: https://sdk.usedocs.com/article/26495 Example of a style identifier for an ImageView-based element. ```text Usedesk.Chat.Attachment.Dialog.Storage.Image ``` -------------------------------- ### Get Knowledge Base Instance Source: https://sdk.usedocs.com/article/26515 Obtains an existing instance of the Knowledge Base. ```kotlin val usedeskKnowledgeBase = UsedeskKnowledgeBaseSdk.getInstance() ``` -------------------------------- ### Text Style Example Source: https://sdk.usedocs.com/article/26495 Example of a style identifier for a TextView-based element. ```text Usedesk.Chat.Attachment.Dialog.Storage.Text ``` -------------------------------- ### Get Knowledge Base Configuration Source: https://sdk.usedocs.com/article/26515 Retrieves the current Knowledge Base configuration. ```kotlin val knowledgeBaseConfiguration= UsedeskKnowledgeBaseSdk.requireConfiguration() ``` -------------------------------- ### Get Chat Configuration Source: https://sdk.usedocs.com/article/26498 Retrieves the current chat configuration. ```kotlin val chatConfiguration = usedeskChat.requireConfiguration() ``` -------------------------------- ### EditText Style Example Source: https://sdk.usedocs.com/article/26495 Example of a style identifier for an EditText-based element. ```text Usedesk.Chat.Screen.Offline.Form.Email.EditText ``` -------------------------------- ### Get Chat Instance Source: https://sdk.usedocs.com/article/26498 Retrieves an instance of an already initialized chat. ```kotlin val usedeskChat = UsedeskChatSdk.getInstance() ``` -------------------------------- ### Get Article Content Source: https://sdk.usedocs.com/article/26515 Retrieves the full content of a specific article by its ID. ```kotlin fun getArticle(articleId: Long): UsedeskArticleContent fun getArticleRx(articleId: Long): Single ``` ```kotlin val article = usedeskKnowledgeBase.getArticle(articleId) usedeskKnowledgeBase.getArticleRx(articleId).subscribe({ article -> //loaded }, { throwable -> throwable.printStackTrace() }) ``` -------------------------------- ### init Source: https://sdk.usedocs.com/article/26515 Initializes the Knowledge Base SDK with the provided context. ```APIDOC ## init(context: Context) ### Description Initializes the Knowledge Base SDK with the provided context. ### Parameters - **context** (Context) - Required - The application context. ### Example ``` val usedeskKnowledgeBase = UsedeskKnowledgeBaseSdk.init(requireContext()) ``` ``` -------------------------------- ### init Source: https://sdk.usedocs.com/article/26498 Initializes the chat SDK. ```APIDOC ## init(context: Context): IUsedeskChat ### Description Initializes the chat SDK with the provided Android context. ### Parameters - **context** (Context) - Required - The application or activity context. ### Example ```kotlin val usedeskChat = UsedeskChatSdk.init(requireContext()) ``` ``` -------------------------------- ### Initialize Knowledge Base Source: https://sdk.usedocs.com/article/26515 Initializes the Knowledge Base SDK with the provided Android context. ```kotlin val usedeskKnowledgeBase = UsedeskKnowledgeBaseSdk.init(requireContext()) ``` -------------------------------- ### getInstance Source: https://sdk.usedocs.com/article/26515 Obtains an instance of the Knowledge Base. ```APIDOC ## getInstance() ### Description Obtains an instance of the Knowledge Base. ### Example ``` val usedeskKnowledgeBase = UsedeskKnowledgeBaseSdk.getInstance() ``` ``` -------------------------------- ### connect Source: https://sdk.usedocs.com/article/26498 Establishes a connection to the chat server. ```APIDOC ## connect() ### Description Connects the client to the Usedesk chat server. ``` -------------------------------- ### Initialize Chat Source: https://sdk.usedocs.com/article/26498 Initializes the chat SDK with the provided context. ```kotlin val usedeskChat = UsedeskChatSdk.init(requireContext()) ``` -------------------------------- ### requireConfiguration Source: https://sdk.usedocs.com/article/26515 Retrieves the current Knowledge Base configuration. ```APIDOC ## requireConfiguration() ### Description Retrieves the current Knowledge Base configuration. ### Example ``` val knowledgeBaseConfiguration = UsedeskKnowledgeBaseSdk.requireConfiguration() ``` ``` -------------------------------- ### Configure Usedesk UI Style Source: https://sdk.usedocs.com/article/26492 Apply custom styles to the Usedesk interface by initializing a ConfigurationStyle object and assigning it to the usedesk instance. ```swift usedesk.configurationStyle = ConfigurationStyle(navigationBarStyle: NavigationBarStyle(backgroundColor: .red, backButtonImage: UIImage())) ``` -------------------------------- ### Retrieve Knowledge Base Sections Source: https://sdk.usedocs.com/article/26515 Fetches a list of sections from the knowledge base. ```kotlin fun getSections(): List fun getSectionsRx(): Single> ``` ```kotlin val sections = usedeskKnowledgeBase.getSections() usedeskKnowledgeBase.getSectionsRx().subscribe({ sections -> //loaded }, { throwable -> throwable.printStackTrace() }) ``` -------------------------------- ### Send Files Source: https://sdk.usedocs.com/article/26498 Send a list of files to the chat session using UsedeskFileInfo objects. ```kotlin val usedeskFileInfoList = listOf(UsedeskFileInfo.create(fileUri)) usedeskChat.send(usedeskFileInfoList) usedeskChat.sendRx(usedeskFileInfoList).subscribe({ //completed }, { throwable-> throwable.printStackTrace() }) ``` -------------------------------- ### BaseArticlesListStyle Source: https://sdk.usedocs.com/article/26489 Configuration structure for the Knowledge Base article list screen. ```APIDOC ## BaseArticlesListStyle ### Description The BaseArticlesListStyle structure defines the visual properties for the article list table cells in the Knowledge Base. ### Parameters - **textFont** (UIFont) - The font used for the article text. - **textColor** (UIColor) - The color of the article text. - **textMargin** (UIEdgeInsets) - The outer margins for the article text. - **separatorColor** (UIColor) - The color of the cell divider. - **separatorLeftMargin** (CGFloat) - The left indentation of the cell divider. - **separatorHeight** (CGFloat) - The height of the cell divider. ``` -------------------------------- ### getInstance Source: https://sdk.usedocs.com/article/26498 Retrieves an instance of an already initialized chat. ```APIDOC ## getInstance(): IUsedeskChat ### Description Returns the existing instance of the initialized chat SDK. ### Example ```kotlin val usedeskChat = UsedeskChatSdk.getInstance() ``` ``` -------------------------------- ### Manage Server Connection Source: https://sdk.usedocs.com/article/26498 Connect to or disconnect from the chat server. Rx variants return a Completable for reactive handling. ```kotlin usedeskChat.connect() usedeskChat.connectRx().subscribe({ //completed }, { throwable-> throwable.printStackTrace() }) ``` ```kotlin usedeskChat.disconnect() usedeskChat.disconnectRx().subscribe({ //completed }, { throwable-> throwable.printStackTrace() }) ``` -------------------------------- ### Configure Knowledge Base Source: https://sdk.usedocs.com/article/26515 Sets the configuration for the Knowledge Base using a UsedeskKnowledgeBaseConfiguration object. ```kotlin UsedeskKnowledgeBaseSdk.setConfiguration(knowledgeBaseConfiguration) ``` -------------------------------- ### requireConfiguration Source: https://sdk.usedocs.com/article/26498 Retrieves the current chat configuration. ```APIDOC ## requireConfiguration(): UsedeskChatConfiguration ### Description Returns the current configuration object used by the chat instance. ### Example ```kotlin val chatConfiguration = usedeskChat.requireConfiguration() ``` ``` -------------------------------- ### Retrieve Knowledge Base Articles Source: https://sdk.usedocs.com/article/26515 Fetches a list of articles for a specific category ID. ```kotlin fun getArticles(categoryId: Long): List fun getArticlesRx(categoryId: Long): Single> ``` ```kotlin val articles = usedeskKnowledgeBase.getArticles(categoryId) usedeskKnowledgeBase.getArticlesRx(categoryId).subscribe({ articles -> //loaded }, { throwable -> throwable.printStackTrace() }) ``` -------------------------------- ### Search Knowledge Base Articles Source: https://sdk.usedocs.com/article/26515 Searches for articles matching a specific query string. ```kotlin fun getArticles(searchQuery: String): List fun getArticlesRx(searchQuery: String): Single> ``` ```kotlin val articles = usedeskKnowledgeBase.getArticles(searchQuery) usedeskKnowledgeBase.getArticlesRx(searchQuery).subscribe({ articles -> //loaded }, { throwable -> throwable.printStackTrace() }) ``` -------------------------------- ### setConfiguration Source: https://sdk.usedocs.com/article/26515 Sets the configuration for the Knowledge Base SDK. ```APIDOC ## setConfiguration(knowledgeBaseConfiguration: UsedeskKnowledgeBaseConfiguration) ### Description Sets the configuration for the Knowledge Base SDK. ### Parameters - **knowledgeBaseConfiguration** (UsedeskKnowledgeBaseConfiguration) - Required - Knowledge Base Configuration ### Example ``` UsedeskKnowledgeBaseSdk.setConfiguration(knowledgeBaseConfiguration) ``` ``` -------------------------------- ### setConfiguration Source: https://sdk.usedocs.com/article/26498 Configures the chat instance with the provided settings. ```APIDOC ## setConfiguration(chatConfiguration: UsedeskChatConfiguration) ### Description Configures the chat instance using the provided UsedeskChatConfiguration object. ### Parameters - **chatConfiguration** (UsedeskChatConfiguration) - Required - Chat configuration object. ### Example ```kotlin usedeskChat.setConfiguration(chatConfiguration) ``` ``` -------------------------------- ### Release Knowledge Base Resources Source: https://sdk.usedocs.com/article/26515 Frees up resources used by the Knowledge Base SDK. ```kotlin UsedeskKnowledgeBaseSdk.release() ``` -------------------------------- ### Submit Article Review Source: https://sdk.usedocs.com/article/26515 Sends a text review for a specific article. ```kotlin fun sendRating(articleId: Long, message: String) fun sendRatingRx(articleId: Long, message: String): Completable ``` ```kotlin usedeskKnowledgeBase.sendRating(articleId, message) usedeskKnowledgeBase.sendRatingRx(articleId, message).subscribe({ //completed }, { throwable -> throwable.printStackTrace() }) ``` -------------------------------- ### send (Files) Source: https://sdk.usedocs.com/article/26498 Sends a list of files to the chat. ```APIDOC ## send(usedeskFileInfoList: List) ### Description Sends a list of file attachments. ### Parameters - **usedeskFileInfoList** (List) - Required - A list of file information objects. ``` -------------------------------- ### BaseStyle Structure Source: https://sdk.usedocs.com/article/26486 The BaseStyle structure defines the visual parameters for knowledge base screens, including background colors, chat button configuration, and search bar styling. ```APIDOC ## BaseStyle ### Description The BaseStyle structure describes the general parameters of the knowledge base screens. ### Parameters - **backColor** (UIColor) - Screen background color - **isNeedChat** (Bool) - Whether to show the chat button - **chatIconImage** (UIImage) - Chat call button icon image - **chatButtonBackColor** (UIColor) - Chat call button background color - **chatButtonCornerRadius** (CGFloat) - Radius of chat call button corners - **chatButtonSize** (CGSize) - Chat call button size - **chatButtonMargin** (UIEdgeInsets) - External indents of the chat button relative to the screen edge - **shadowOffset** (CGSize) - Shift of the chat call button shadow - **shadowOpacity** (Float) - Chat call button shadow transparency - **shadowRadius** (CGFloat) - Size of the chat call button shadow - **shadowColor** (CGColor) - Chat call button shadow color - **searchBarTextBackgroundColor** (UIColor) - Background color of the search text input field - **searchBarTextColor** (UIColor) - Search text color - **searchBarTintColor** (UIColor) - Search call button color - **searchCancelButtonColor** (UIColor) - Color of the search cancel button ``` -------------------------------- ### ChatStyle Configuration Source: https://sdk.usedocs.com/article/27502 The ChatStyle structure allows for the customization of the chat screen's background and loading indicator appearance. ```APIDOC ## ChatStyle ### Description Configuration structure for defining the visual style of the chat screen. ### Parameters - **backgroundColor** (UIColor) - The background color of the chat screen. - **backgroundColorLoaderView** (UIColor) - The background color of the loading loader displayed when the chat is opened. - **alphaLoaderView** (CGFloat) - The transparency level of the loading loader background. ``` -------------------------------- ### NavigationBarStyle Source: https://sdk.usedocs.com/article/26468 Configuration parameters for the NavigationBar component. ```APIDOC ## NavigationBarStyle ### Description Defines the visual style parameters for the NavigationBar component. ### Parameters - **backgroundColor** (UIColor) - Background color of the navigation bar. - **textColor** (UIColor) - Text color for the navigation bar. - **font** (UIFont) - Font used for text in the navigation bar. - **statusBarStyle** (UIStatusBarStyle) - Style of the status bar (light or dark). - **backButtonImage** (UIImage) - Image for the back button (except on file browse screen). - **backButtonInFileImage** (UIImage) - Image for the back button on the file browsing screen. - **searchButtonImage** (UIImage) - Image for the search button in the knowledge base. ``` -------------------------------- ### Increment Article View Count Source: https://sdk.usedocs.com/article/26515 Registers a view for the specified article. ```kotlin fun addViews(articleId: Long) fun addViewsRx(articleId: Long): Completable ``` ```kotlin usedeskKnowledgeBase.addViews(articleId) usedeskKnowledgeBase.addViewsRx(articleId).subscribe({ //completed }, { throwable -> throwable.printStackTrace() }) ``` -------------------------------- ### VideoStyle Source: https://sdk.usedocs.com/article/26475 The VideoStyle structure describes the parameters of messages with video. ```APIDOC ## VideoStyle ### Description The VideoStyle structure defines the visual properties for video messages within the chat interface. ### Parameters - **margin** (UIEdgeInsets) - Outer indents of the video preview image from the edges of the message background. - **imageDefault** (UIImage) - Standard video preview image displayed before upload. - **sizeDefault** (CGSize) - Size of the standard video preview image before upload. ``` -------------------------------- ### getSections Source: https://sdk.usedocs.com/article/26515 Retrieves a list of all available knowledge base sections. ```APIDOC ## getSections() ### Description Retrieves a list of all available knowledge base sections. ### Signature `fun getSections(): List` `fun getSectionsRx(): Single` ``` -------------------------------- ### Handle new incoming messages Source: https://sdk.usedocs.com/article/26467 Sets a block to process new incoming messages. ```swift usedesk.newMessageBlock { success, message in } ``` -------------------------------- ### Configure maximum attachments Source: https://sdk.usedocs.com/article/26467 Sets the maximum number of files that can be attached. ```swift usedesk.maxCountAssets = 5 ``` -------------------------------- ### Retrieve Knowledge Base Categories Source: https://sdk.usedocs.com/article/26515 Fetches a list of categories for a specific section ID. ```kotlin fun getCategories(sectionId: Long): List fun getCategoriesRx(sectionId: Long): Single> ``` ```kotlin val categories = usedeskKnowledgeBase.getCategories(sectionId) usedeskKnowledgeBase.getCategoriesRx(sectionId).subscribe({ categories -> //loaded }, { throwable -> throwable.printStackTrace() }) ``` -------------------------------- ### Configure Chat Source: https://sdk.usedocs.com/article/26498 Sets the chat configuration using a UsedeskChatConfiguration object. ```kotlin usedeskChat.setConfiguration(chatConfiguration) ``` -------------------------------- ### Add an article view indicator Source: https://sdk.usedocs.com/article/26485 Increments the view count for a specific article. ```swift usedesk.addViewsArticle(articleID: id, count: 1, connectionStatus: { success, error in }) ``` -------------------------------- ### Search for articles Source: https://sdk.usedocs.com/article/26485 Performs a search query across the knowledge base with optional filters for collections, categories, and sorting. ```swift usedesk.getSearchArticles(collection_ids: [collection_ids], category_ids: [category_ids], article_ids: [], query: "searchText", type: .all, sort: .title, order: .asc) { (success, searchArticle, error) }) ``` -------------------------------- ### Send a file Source: https://sdk.usedocs.com/article/26467 Sends a file with a specified name and data, including a status callback. ```swift usedesk.sendFile(fileName: "file.png", data: imageData, messageId: "123456789", status: {success, error in }) ``` -------------------------------- ### usedesk.releaseChat Source: https://sdk.usedocs.com/article/26467 Clears SDK parameters and stops WebSockets. ```APIDOC ## usedesk.releaseChat() ### Description Completely clears all SDK parameters and stops working WebSockets. ``` -------------------------------- ### Retrieve knowledge base sections Source: https://sdk.usedocs.com/article/26485 Fetches an array of sections using the getCollections method. ```swift usedesk.getCollections(connectionStatus: {success, collections, error }) ``` -------------------------------- ### usedesk.sendFile Source: https://sdk.usedocs.com/article/26467 Sends a file attachment to the chat. ```APIDOC ## usedesk.sendFile(fileName, data, messageId, status) ### Description Sends a file to the chat. Multiple files must be sent in separate calls. ### Parameters - **fileName** (String) - Required - The name of the file. - **data** (Data) - Required - The file content. - **messageId** (String) - Optional - A unique identifier for the message. - **status** (Closure) - Optional - Callback block returning success or error status. ``` -------------------------------- ### Release session Source: https://sdk.usedocs.com/article/26467 Clears all SDK parameters and stops active WebSockets. ```swift usedesk.releaseChat() ``` -------------------------------- ### Rate an Article Source: https://sdk.usedocs.com/article/26515 Submits a positive or negative rating for an article. ```kotlin fun sendRating(articleId: Long, good: Boolean) fun sendRatingRx(articleId: Long, good: Boolean): Completable ``` ```kotlin usedeskKnowledgeBase.sendRating(articleId, good) usedeskKnowledgeBase.sendRatingRx(articleId, good).subscribe({ //completed }, { throwable -> throwable.printStackTrace() }) ``` -------------------------------- ### Retrieve a specific article Source: https://sdk.usedocs.com/article/26485 Fetches an article by its ID using the getArticle method. ```swift usedesk?.getArticle(articleID: id, connectionStatus: { success, article, error }) ``` -------------------------------- ### Handle connection errors Source: https://sdk.usedocs.com/article/26467 Sets a block to receive connection error notifications. ```swift usedesk.errorBlock = {errors in } ``` -------------------------------- ### Set Notification Service Factory Source: https://sdk.usedocs.com/article/26498 Configures a custom factory for the notification service. ```kotlin val customNotificationsServiceFactory = object : UsedeskNotificationsServiceFactory{...} usedeskChat.setNotificationsServiceFactory(customNotificationsServiceFactory) ``` -------------------------------- ### Handle connection status Source: https://sdk.usedocs.com/article/26467 Sets a block to handle connection success or error states. ```swift usedesk.connectBlock = { success, error in } ``` -------------------------------- ### BaseSectionsStyle Structure Source: https://sdk.usedocs.com/article/26487 The BaseSectionsStyle structure allows for the customization of the knowledge base section list UI components. ```APIDOC ## BaseSectionsStyle ### Description The BaseSectionsStyle structure describes the screen parameters of the list of knowledge base sections. ### Parameters - **textFont** (UIFont) - text font - **textColor** (UIColor) - text color - **textMargin** (UIEdgeInsets) - outer text indent - **iconDefaultImage** (UIImage) - icon background image - **iconFont** (UIFont) - the font of the text in the section icon - **iconTextColor** (UIColor) - the color of the text in the section icon - **iconSize** (CGSize) - section icon size - **iconMargin** (UIEdgeInsets) - the outer indents of the section icon (Left and top indents are taken into account) - **ArrowImage** (UIImage) - image of the navigation to the section button - **arrowSize** (CGSize) - size of the navigation to the section button - **arrowMargin** (UIEdgeInsets) - external indent of the section navigation button (Right and top indents are taken into account) - **separatorColor** (UIColor) - divider color - **separatorLeftMargin** (CGFloat) - left indent of the divider - **separatorHeight** (CGFloat) - divider height ``` -------------------------------- ### Usedesk.Chat.Message.Image.Client Source: https://sdk.usedocs.com/article/26506 Customization details for the customer message with image style, inheriting from Usedesk.Chat.Message.Image. ```APIDOC ## Customization: Usedesk.Chat.Message.Image.Client ### Description Defines the visual style for customer-sent image messages in the chat interface. ### Parent Style Usedesk.Chat.Message.Image ### Attributes | Name | Description | Standard value | |---|---|---| | usedesk_chat_message_bubble_background | Link to the message background | @drawable/usedesk_background_bubble_client | ``` -------------------------------- ### addActionListener Source: https://sdk.usedocs.com/article/26498 Registers an event listener to receive chat updates. ```APIDOC ## addActionListener(listener: IUsedeskActionListener) ### Description Registers an event listener to handle chat events. ### Parameters - **listener** (IUsedeskActionListener) - Required - The listener instance to add. ``` -------------------------------- ### BaseSearchStyle Source: https://sdk.usedocs.com/article/26490 Configuration parameters for the search result cell appearance in the Knowledge Base. ```APIDOC ## BaseSearchStyle ### Description The BaseSearchStyle structure defines the visual properties for cells displayed in the Knowledge Base search results. ### Parameters - **titleFont** (UIFont) - Font of the founded article text title - **titleColor** (UIColor) - Color of the founded article text title - **titleMargin** (UIEdgeInsets) - Outer indents of the founded article text title - **textFont** (UIFont) - Font of the founded article excerpt text - **textColor** (UIColor) - Text color of the founded article excerpt text - **textMargin** (UIEdgeInsets) - External indents of the founded article excerpt text (left, right, bottom) - **pathFont** (UIFont) - Font of the found article path text - **pathColor** (UIColor) - Text color of the found article path text - **pathMargin** (UIEdgeInsets) - External indents of the found article path text (left, right, bottom) - **separatorColor** (UIColor) - Divider color - **separatorLeftMargin** (CGFloat) - Left indent of the divider - **separatorHeight** (CGFloat) - Divider height ``` -------------------------------- ### PictureStyle Source: https://sdk.usedocs.com/article/26474 The PictureStyle structure describes the parameters of messages with a photo. ```APIDOC ## PictureStyle ### Description The PictureStyle structure describes the parameters of messages with a photo. ### Parameters - **margin** (UIEdgeInsets) - outer indents of the image from the edges of the message background - **imageDefault** (UIImage) - standard image of the photo before upload - **sizeDefault** (CGSize) - the size of the standard image of the photo before uploading ``` -------------------------------- ### release Source: https://sdk.usedocs.com/article/26515 Frees the resources used by the Knowledge Base. ```APIDOC ## release() ### Description Frees the resources used by the Knowledge Base. ### Example ``` UsedeskKnowledgeBaseSdk.release() ``` ``` -------------------------------- ### Accessing Feedback Form Settings Source: https://sdk.usedocs.com/article/26483 Access the feedback form settings object after chat initialization. ```swift usedesk.callbackSettings ``` -------------------------------- ### Check SDK UI state Source: https://sdk.usedocs.com/article/26467 Checks if the SDK windows are currently open. ```swift usedesk.isOpenSDKUI ``` -------------------------------- ### send (Rate) Source: https://sdk.usedocs.com/article/26498 Submits feedback for an agent's message. ```APIDOC ## send(message: UsedeskMessageAgentText, feedback: UsedeskFeedback) ### Description Submits a rating (LIKE/DISLIKE) for a specific agent message. ### Parameters - **message** (UsedeskMessageAgentText) - Required - The agent message being rated. - **feedback** (UsedeskFeedback) - Required - The feedback score. ``` -------------------------------- ### SelectTopicFeedbackFormStyle Source: https://sdk.usedocs.com/article/26482 The SelectTopicFeedbackFormStyle structure defines the visual appearance of the theme selection screen within the feedback flow. ```APIDOC ## SelectTopicFeedbackFormStyle ### Description The SelectTopicFeedbackFormStyle structure describes the options for the theme selection screen. ### Properties - **titleTopicFont** (UIFont) - Theme text font - **titleTopicColor** (UIColor) - Theme text color - **titleTopicMargin** (UIEdgeInsets) - Theme text margin - **lineSeparatorColor** (UIColor) - Divider color - **selectImage** (UIImage) - Inactive selection icon image - **selectedImage** (UIImage) - Active selection icon image - **selectImageSize** (CGSize) - Select icon size - **selectImageMarginRight** (CGFloat) - Selection icon right indent ``` -------------------------------- ### addViews Source: https://sdk.usedocs.com/article/26515 Increments the view count for a specific article. ```APIDOC ## addViews(articleId: Long) ### Description Increments the view count for the specified article. ### Signature `fun addViews(articleId: Long)` `fun addViewsRx(articleId: Long): Completable` ### Parameters - **articleId** (Long) - Required - The ID of the article. ``` -------------------------------- ### Send Text Messages Source: https://sdk.usedocs.com/article/26498 Send a text message to the chat session. ```kotlin val textMessage = "Hello" usedeskChat.send(textMessage) usedeskChat.sendRx(textMessage).subscribe({ //completed }, { throwable-> throwable.printStackTrace() }) ``` -------------------------------- ### getCollections Source: https://sdk.usedocs.com/article/26485 Retrieves an array of knowledge base sections. ```APIDOC ## getCollections ### Description Returns an array of sections (BaseCollection). ### Example ``` usedesk.getCollections(connectionStatus: {success, collections, error }) ``` ``` -------------------------------- ### Replace SDK Style Source: https://sdk.usedocs.com/article/26495 Use this method to register a custom style to replace a standard SDK component style. ```java UsedeskResourceManager.replaceResourceId(com.usedesk.chat_gui.R.style. Usedesk_Chat_Screen, R.style.Usedesk_Chat_Screen_Custom) ``` -------------------------------- ### BubbleStyle Configuration Source: https://sdk.usedocs.com/article/26470 The BubbleStyle structure defines the default style options for the background UIView of the chat message. ```APIDOC ## BubbleStyle ### Description Defines the style options for the background UIView of chat messages. ### Parameters - **bubbleMarginLeft** (CGFloat) - The minimum indentation of the message from the left edge of the screen. - **bubbleMarginRight** (CGFloat) - The minimum indentation of the message from the right edge of the screen. - **bubbleRadius** (CGFloat) - Corner radius of the bubble. - **bubbleWidthMin** (CGFloat) - Minimum message width. - **bubbleHeightMin** (CGFloat) - Minimum message height. - **spacingOneSender** (CGFloat) - Indentation between posts from different authors. - **spacingDifferentSender** (CGFloat) - Indentation between posts from the same author. - **bubbleColorOutgoing** (UIColor) - Outgoing message background color. - **bubbleColorIncoming** (UIColor) - The background color of the incoming message. ``` -------------------------------- ### release Source: https://sdk.usedocs.com/article/26498 Frees chat resources. ```APIDOC ## release(force: Boolean = true) ### Description Releases resources used by the chat SDK. ### Parameters - **force** (Boolean) - Optional - Flag for hard release of resources (true - release immediately, false - release if no event listeners). ### Example ```kotlin UsedeskChatSdk.release(false) ``` ``` -------------------------------- ### Usedesk.Chat.Message.Image Source: https://sdk.usedocs.com/article/26513 Style configuration for chat messages containing images, including error handling, preview styling, and timestamp formatting. ```APIDOC ## Style: Usedesk.Chat.Message.Image ### Description Defines the visual style for chat messages that contain images. Inherits from Usedesk.Chat.Message. ### Attributes | Name | Description | Standard value | |---|---|---| | usedesk_chat_message_image_error_image | Error image style | @style/Usedesk.Chat.Message.Image.Error.Image | | usedesk_chat_message_image_preview_image | Load image style | @style/Usedesk.Chat.Message.Image.Preview.Image | | usedesk_chat_message_image_time_background | Message time background | @drawable/usedesk_background_time_dark | | usedesk_chat_message_time_text | Message time style | @style/Usedesk.Chat.Message.Time.Light.Text | ``` -------------------------------- ### Rate Agent Messages Source: https://sdk.usedocs.com/article/26498 Submit feedback (LIKE or DISLIKE) for a specific agent message. ```kotlin fun onFeedbackClick(agentMessage: UsedeskMessageAgentText, like: Boolean){ val feedback = if (like){ UsedeskFeedback.LIKE } else { UsedeskFeedback.DISLIKE } usedeskChat.send(agentMessage, feedback) usedeskChat.sendRx(usedeskFileInfoList).subscribe({ //completed }, { throwable-> throwable.printStackTrace() }) } ``` -------------------------------- ### Usedesk.Chat.Attachment.Dialog.Camera.Text Style Source: https://sdk.usedocs.com/article/26501 Defines the style for the camera attachment text option. ```APIDOC ## Usedesk.Chat.Attachment.Dialog.Camera.Text ### Description Style configuration for the camera attachment dialog text. ### Attributes | Name | Description | Standard value | |---|---|---| | usedesk_drawable_1 | Link to the image | @drawable/usedesk_ic_attached_file | | riv_corner_radius | Edges rounding radius | 10dp | ``` -------------------------------- ### Check Listener Status Source: https://sdk.usedocs.com/article/26498 Verify if there are any active listeners registered. ```kotlin if (UsedeskKnowledgeBaseSdk.getInstance().isNoListeners()) {...} ``` -------------------------------- ### InputViewStyle Source: https://sdk.usedocs.com/article/26477 The InputViewStyle structure defines the visual parameters for the message input element. ```APIDOC ## InputViewStyle ### Description The InputViewStyle structure describes the parameters of the message input element. ### Parameters - **viewBackColor** (UIColor) - Background color of the message input element. - **textBackColor** (UIColor) - Background color of the message input text. - **textColor** (UIColor) - Text color. - **placeholderTextColor** (UIColor) - Placeholder text color. - **font** (UIFont) - Text font. - **textHeightMin** (CGFloat) - Minimum text height. - **textHeightMax** (CGFloat) - Maximum text height. - **textMargin** (UIEdgeInsets) - External indents of the message text relative to the background of the text. - **inputTextViewBorderWidth** (CGFloat) - The width of the background message text frame. - **inputTextViewBorderColor** (UIColor) - Background border message text color. - **inputTextViewRadius** (CGFloat) - The radius of the background rounding message text. - **inputTextViewMargin** (UIEdgeInsets) - Outer indents of the message text background. - **heightAssetsCollection** (CGFloat) - Collection height with photo/video. - **topMarginAssetsCollection** (CGFloat) - Outer top indent of the collection with photo/video to the message input field. ``` -------------------------------- ### Release Chat Resources Source: https://sdk.usedocs.com/article/26498 Releases chat resources. The force parameter determines if resources are released immediately or only if no listeners are active. ```kotlin UsedeskChatSdk.release(false) ``` -------------------------------- ### FileStyle Structure Source: https://sdk.usedocs.com/article/26476 The FileStyle structure defines the visual properties for file messages, including icon settings, file name styling, and file size styling. ```APIDOC ## FileStyle Structure ### Description The FileStyle structure describes the parameters of messages with files, allowing for customization of icons, file names, and file sizes. ### Properties #### Icon Settings - **iconMargin** (UIEdgeInsets) - File icon indents relative to message edges and file name. - **imageIcon** (UIImage) - File icon image. - **iconSize** (CGSize) - File icon image size. #### File Name Settings - **fontName** (UIFont) - File name text font. - **nameMargin** (UIEdgeInsets) - External indents of the file name text (top edge of message background and right edge). - **nameColor** (UIColor) - The color of the file name text. #### File Size Settings - **fontSize** (UIFont) - File size text font. - **sizeMargin** (UIEdgeInsets) - File size text margins (top indent up to the file name and to the right edge of the message background). - **sizeColor** (UIColor) - File size text color. ``` -------------------------------- ### BaseCategoriesStyle Source: https://sdk.usedocs.com/article/26488 The BaseCategoriesStyle structure defines the visual parameters for the list of knowledge base categories, including text styling, layout margins, and navigation elements. ```APIDOC ## BaseCategoriesStyle ### Description The BaseCategoriesStyle structure describes the screen parameters of the list of knowledge base categories. ### Parameters - **textFont** (UIFont) - text font - **textColor** (UIColor) - text color - **textMargin** (UIEdgeInsets) - outer indentation of the category headings text - **countArticlesFont** (UIFont) - font of the article number in the category text - **countArticlesColor** (UIColor) - text color of the article number in the category - **countArticlesMargin** (UIEdgeInsets) - external indents of the text of the number of articles in the category (Top and right indents are taken into account) - **descriptionFont** (UIFont) - category description text font - **descriptionColor** (UIColor) - category description text color - **descriptionMargin** (UIEdgeInsets) - outer indents of the category description text (Left, bottom, and right indents are taken into account) - **arrowImage** (UIImage) - image of the section navigation button - **arrowSize** (CGSize) - size of the navigation to section button - **arrowMargin** (UIEdgeInsets) - external indent of the section navigation button (Right and top indents are taken into account) - **separatorColor** (UIColor) - divider color - **separatorLeftMargin** (CGFloat) - left indent of the divider - **separatorHeight** (CGFloat) - divider height ``` -------------------------------- ### Send Offline Feedback Form Source: https://sdk.usedocs.com/article/26498 Submit an offline form containing user contact details and a message. ```kotlin val offlineForm = UsedeskOfflineForm( "John Smith", "john.smith@email.com", "Hello" ) usedeskChat.send(offlineForm) usedeskChat.sendRx(offlineForm).subscribe({ //completed }, { throwable-> throwable.printStackTrace() }) ``` -------------------------------- ### Usedesk.Chat.Attached.File Style Source: https://sdk.usedocs.com/article/26501 Defines the base style and child attributes for attached file components in the chat interface. ```APIDOC ## Usedesk.Chat.Attached.File ### Description Base style for attached files in the chat interface. ### Attributes | Name | Description | Standard value | |---|---|---| | usedesk_chat_attached_file_close_image | Closing button image style | @style/Usedesk.Chat.Attached.File.Close.Image | | usedesk_chat_attached_file_preview_image | Base Preview Image Style | @style/Usedesk.Chat.Attached.File.Preview.Image | | usedesk_chat_attached_file_name_text | File name text style | @style/Usedesk.Chat.Attached.File.Name.Text | ``` -------------------------------- ### MessageStyle Structure Source: https://sdk.usedocs.com/article/26472 The MessageStyle structure defines the visual properties for chat messages. Below are the available configuration parameters. ```APIDOC ## MessageStyle Structure ### Description Defines the visual styling for chat messages, including text, time stamps, media backgrounds, and status indicators. ### Parameters - **textOutgoingColor** (UIColor) - Outgoing message text color - **textIncomingColor** (UIColor) - Incoming message text color - **font** (UIFont) - Font of the message text - **textMargin** (UIEdgeInsets) - Outer padding of the message text - **timeOutgoingColor** (UIColor) - Outgoing message sending time text color - **timeIncomingColor** (UIColor) - Incoming message sending time text color (incoming) - **timeFont** (UIFont) - Font of the message sending time - **timeMargin** (UIEdgeInsets) - External indents of the message sending time - **timeMarginRightForStatus** (CGFloat) - Indent to the right for the submission status image - **timeOutgoingPictureColor** (UIColor) - Text color of sending time for outgoing photo/video message - **timeIncomingPictureColor** (UIColor) - Text color of sending time for incoming photo/video message - **timeBackViewOutgoingColor** (UIColor) - Background color of the photo/video sending time (outgoing) - **timeBackViewIncomingColor** (UIColor) - Background color of the photo/video sending time (incoming) - **timeBackViewOpacity** (CGFloat) - Transparency of the background color of the photo/video sending time - **timeBackViewCornerRadius** (CGFloat) - Rounding radius of the background color of the photo/video sending time - **timeBackViewPadding** (UIEdgeInsets) - Internal indents of the background of the sending time - **sendStatusImage** (UIImage) - "Sent" status image - **sendedStatusImage** (UIImage) - "Delivered" status image - **sendStatusImageForImageMessage** (UIImage) - "Sent" status image for image messages - **sendedStatusImageForImageMessage** (UIImage) - "Delivered" status image for image messages - **sendedStatusSize** (CGSize) - Status image size - **sendedStatusMargin** (UIEdgeInsets) - Outer indents of the status image - **notSentImage** (UIImage) - "Not delivered" status image - **notSentImageSize** (CGSize) - Size of "not delivered" status image - **notSentImageMarginToBubble** (CGFloat) - Indent to the right before the message - **senderTextColor** (UIColor) - Text color of the author's name - **senderTextFont** (UIFont) - Font of the author's name - **senderTextMarginBottom** (CGFloat) - Bottom indent of the author's name text ``` -------------------------------- ### Usedesk.Chat.Message.Image.Agent Source: https://sdk.usedocs.com/article/26509 Defines the customization attributes for agent messages containing images, inheriting from Usedesk.Chat.Message.Image. ```APIDOC ## Style: Usedesk.Chat.Message.Image.Agent ### Description Customizes the appearance of agent messages that contain images. This style inherits from `Usedesk.Chat.Message.Image`. ### Attributes | Name | Description | Standard value | |---|---|---| | usedesk_chat_message_bubble_background | Message background link | @drawable/usedesk_background_bubble_agent | ``` -------------------------------- ### getCategories Source: https://sdk.usedocs.com/article/26515 Retrieves a list of categories within a specific section. ```APIDOC ## getCategories(sectionId: Long) ### Description Retrieves a list of categories for the specified section ID. ### Signature `fun getCategories(sectionId: Long): List` `fun getCategoriesRx(sectionId: Long): Single` ### Parameters - **sectionId** (Long) - Required - The ID of the section to retrieve categories from. ``` -------------------------------- ### Usedesk.Chat.Attached.File.Close.Image Style Source: https://sdk.usedocs.com/article/26501 Defines the style for the close button on attached files. ```APIDOC ## Usedesk.Chat.Attached.File.Close.Image ### Description Style configuration for the close button image. ### Attributes | Name | Description | Standard value | |---|---|---| | srcCompat | Link to the image | @drawable/usedesk_ic_preview_detach | ``` -------------------------------- ### usedesk.closeChat Source: https://sdk.usedocs.com/article/26467 Clears history and terminates WebSockets. ```APIDOC ## usedesk.closeChat() ### Description Clears message history and terminates WebSockets. ``` -------------------------------- ### usedesk.sendMessage Source: https://sdk.usedocs.com/article/26467 Sends a text message to the chat. ```APIDOC ## usedesk.sendMessage(message, messageId) ### Description Sends a text message to the current chat session. ### Parameters - **message** (String) - Required - The message text to send. - **messageId** (String) - Optional - A unique identifier for the message to track delivery status. ``` -------------------------------- ### setNotificationsServiceFactory Source: https://sdk.usedocs.com/article/26498 Sets the factory for the notification service. ```APIDOC ## setNotificationsServiceFactory(usedeskNotificationsServiceFactory: UsedeskNotificationsServiceFactory) ### Description Registers a custom factory for creating notification services. ### Parameters - **usedeskNotificationsServiceFactory** (UsedeskNotificationsServiceFactory) - Required - The service factory implementation. ### Example ```kotlin val customNotificationsServiceFactory = object : UsedeskNotificationsServiceFactory{...} usedeskChat.setNotificationsServiceFactory(customNotificationsServiceFactory) ``` ``` -------------------------------- ### usedesk.sendMessageFeedBack Source: https://sdk.usedocs.com/article/26467 Submits a CSI assessment for a specific message. ```APIDOC ## usedesk.sendMessageFeedBack(status) ### Description Submits a feedback score (like/dislike) for a specific message. ### Parameters - **status** (Bool) - Required - True for like, false for dislike. ``` -------------------------------- ### getArticle Source: https://sdk.usedocs.com/article/26485 Retrieves a specific article by its ID. ```APIDOC ## getArticle ### Description Returns the article class for a given article ID. ### Parameters - **articleID** (Int) - Required - The ID of the article to retrieve. ### Example ``` usedesk?.getArticle(articleID: id, connectionStatus: { success, article, error }) ``` ``` -------------------------------- ### sendRating Source: https://sdk.usedocs.com/article/26515 Rates an article or leaves a review. ```APIDOC ## sendRating(articleId: Long, feedback) ### Description Submits a positive/negative rating or a text review for an article. ### Signature `fun sendRating(articleId: Long, good: Boolean)` `fun sendRatingRx(articleId: Long, good: Boolean): Completable` `fun sendRating(articleId: Long, message: String)` `fun sendRatingRx(articleId: Long, message: String): Completable` ### Parameters - **articleId** (Long) - Required - The ID of the article. - **good** (Boolean) - Optional - Positive (true) or negative (false) feedback. - **message** (String) - Optional - Text content of the review. ``` -------------------------------- ### Sending an Offline Form Source: https://sdk.usedocs.com/article/26483 Submit an offline form with client details and custom fields to the server. ```swift usedesk.sendOfflineForm(name: "Name", email: "email@email.com", message: "Message", topic: "Topic", fields: [UDCallbackCustomField(title: "Field1", text: "Value1"), UDCallbackCustomField(title: "Field2", text: "Value22")]) { (result, error) in} ``` -------------------------------- ### getArticles Source: https://sdk.usedocs.com/article/26515 Retrieves a list of articles for a category or performs a search. ```APIDOC ## getArticles(categoryId: Long) / getArticles(searchQuery: String) ### Description Retrieves a list of articles by category ID or performs a text search for articles. ### Signature `fun getArticles(categoryId: Long): List` `fun getArticlesRx(categoryId: Long): Single` `fun getArticles(searchQuery: String): List` `fun getArticlesRx(searchQuery: String): Single` ### Parameters - **categoryId** (Long) - Optional - The ID of the category. - **searchQuery** (String) - Optional - The text query for searching articles. ``` -------------------------------- ### Access message history Source: https://sdk.usedocs.com/article/26467 Retrieves the message history after chat initialization. ```swift usedesk.historyMess ``` -------------------------------- ### FeedbackFormStyle Configuration Source: https://sdk.usedocs.com/article/26481 The FeedbackFormStyle structure defines the visual properties for the feedback form screen, including buttons, text, and table cell elements. ```APIDOC ## FeedbackFormStyle ### Description The FeedbackFormStyle structure describes the parameters of the feedback form screen. ### Parameters - **buttonColor** (UIColor) - The background color of the active sending button. - **buttonColorDisabled** (UIColor) - Background color of the inactive sending button. - **buttonTextColor** (UIColor) - Sending button text color. - **buttonFont** (UIFont) - Sending button text font. - **buttonCornerRadius** (CGFloat) - Sending button rounding radius. - **textColor** (UIColor) - Description text color. - **textFont** (UIFont) - Description text font. - **headerFont** (UIFont) - Title text font for the contact form cell. - **headerColor** (UIColor) - Title text color for the contact form cell. - **headerSelectedColor** (UIColor) - Color of the selected field header. - **valueFont** (UIFont) - The text font value. - **valueColor** (UIColor) - The text color value. - **arrowImage** (UIImage) - Next button icon. - **arrowImageSize** (CGSize) - Size of the next button. - **lineSeparatorColor** (UIColor) - Divider color. - **lineSeparatorActiveColor** (UIColor) - Divider under the selected cell color. - **errorColor** (UIColor) - Cell header color in error mode. - **sendedImage** (UIImage) - An image of a successful submission in a pop-up window. ``` -------------------------------- ### send (Text Message) Source: https://sdk.usedocs.com/article/26498 Sends a text message to the chat. ```APIDOC ## send(textMessage: String) ### Description Sends a plain text message. ### Parameters - **textMessage** (String) - Required - The text content to send. ``` -------------------------------- ### AttachButtonStyle Source: https://sdk.usedocs.com/article/26478 The AttachButtonStyle structure defines the visual properties and layout constraints for the file attachment button within the chat interface. ```APIDOC ## AttachButtonStyle ### Description The AttachButtonStyle structure describes the parameters of the file attachment button. ### Parameters - **margin** (UIEdgeInsets) - The outer indent of the button relative to the input field and the edges of the message input element. - **size** (CGSize) - The dimensions of the button. - **image** (UIImage) - The image displayed on the button. ``` -------------------------------- ### addViewsArticle Source: https://sdk.usedocs.com/article/26485 Increments the view count for a specific article. ```APIDOC ## addViewsArticle ### Description Adds a view indicator to an article. ### Parameters - **articleID** (Int) - Required - The ID of the article. - **count** (Int) - Required - The number of views to add. ### Example ``` usedesk.addViewsArticle(articleID: id, count: 1, connectionStatus: { success, error in }) ``` ``` -------------------------------- ### Handle operator feedback Source: https://sdk.usedocs.com/article/26467 Sets a block to handle messages sent when an operator ends a call. ```swift usedesk.feedbackMessageBlock = { message in } ``` -------------------------------- ### Restrict attachment types Source: https://sdk.usedocs.com/article/26467 Configures whether only photos are supported for attachments. ```swift usedesk.isSupportedAttachmentOnlyPhoto = true ``` -------------------------------- ### FeedbackMessageStyle Structure Source: https://sdk.usedocs.com/article/26473 The FeedbackMessageStyle structure defines the visual parameters for messages that include a rating choice. ```APIDOC ## FeedbackMessageStyle ### Description The FeedbackMessageStyle structure describes the parameters of messages with a choice of rating. ### Parameters - **buttonSize** (CGSize) - rating button size - **buttonsMargin** (UIEdgeInsets) - the outer indent of the evaluation button relative to the top of the message, the left and right edges - **likeOnImage** (UIImage) - the image of the positive rating button after clicking - **likeOffImage** (UIImage) - the image of the positive rating button before being assigned - **dislikeOnImage** (UIImage) - negative rating button image after clicking - **dislikeOffImage** (UIImage) - the image of the negative rating button before clicking - **textColor** (UIColor) - message text color - **font** (UIFont) - the font of the message text - **textMargin** (UIEdgeInsets) - outer indent of the message text relative to the buttons at the top and edges of the message background - **textFinished** (String) - text of the message after sending the rating ``` -------------------------------- ### Add and Remove Action Listeners Source: https://sdk.usedocs.com/article/26498 Register or unregister listeners to handle chat events. Use IUsedeskActionListener for standard callbacks or IUsedeskActionListenerRx for reactive streams. ```kotlin val listener = object : IUsedeskActionListener{ ... } usedeskChat.addActionListener(listener) val listenerRx = object : IUsedeskActionListenerRx{ ... } usedeskChat.addActionListenerRx(listener) ``` ```kotlin usedeskChat.removeActionListener(listener) usedeskChat.removeActionListener(listenerRx) ``` -------------------------------- ### MessageButtonStyle Source: https://sdk.usedocs.com/article/26480 The MessageButtonStyle structure defines the styling parameters for buttons displayed within messages. ```APIDOC ## MessageButtonStyle ### Description The MessageButtonStyle structure describes the parameters of buttons inside messages. ### Parameters - **color** (UIColor) - Button background color - **textColor** (UIColor) - Text color - **textFont** (UIFont) - Text font - **cornerRadius** (CGFloat) - Radius of the button corners - **margin** (UIEdgeInsets) - Outer indents of the button - **padding** (UIEdgeInsets) - Indent of the button relative to the button text ```