Skip to content

Additional Features of Rox.Chat Mobile SDK for iOS

This article lists features of Rox.Chat Mobile SDK for iOS that are unavailable by default. To enable them, please contact technical support.

N.B.

This article is a supplement to the main manual on Rox.Chat Mobile SDK for iOS.

Class Roxchat

Class method newFAQBuilder()

Method needed to get an object FAQBuilder, which in turn is needed to create an instance of class FAQ.

Class FAQBuilder

A class whose instance is used to get an instance of class FAQ. An instance of the class is obtained using the newFAQBuilder() method of the Roxchat class.

Instance method set(accountName:)

The method is required to set the account name in the Rox.Chat system when creating an FAQ block.

The accountName parameter is the name of the client's account in the Rox.Chat system. Usually it is a server URL (e.g. https://demo.rox.chat), but it can be a single word account name (e.g. demo) if the server is in the rox.chat. domain.

Returns the same instance of class FAQBuilder, but with the account name set. The method call is required to get an instance of FAQ.

Instance method set(application:)

The method is required to set the name of the application in the Rox.Chat system when creating an FAQ block.

The application parameter is the name of the client application in the Rox.Chat system.

Returns the same instance of the FAQBuilder class, but with the account name set.

Instance method set(departmentKey:)

The method is required to set the department key in the Rox.Chat system when creating an FAQ block.

The departmentKey parameter is the name of the client's application in the Rox.Chat system.

Returns the same instance of the FAQBuilder class, but with the account name set.

Instance method set(language:)

The method is required to set the language in the Rox.Chat system when creating an FAQ block.

The language parameter is the language of the client in the Rox.Chat system.

Returns the same instance of FAQBuilder class, but with the account name set.

Instance method build()

A method that is called at the conclusion of the above methods to get an instance of FAQ.

Returns a FAQ object with the parameters set using the rest of the class instance methods.

May throw errors of type FAQBuilderError.

Requires calling the set(accountName:) method.


Protocol FAQ

A protocol that allows manipulation of the current list of frequently asked questions. An instance of the FAQ class is obtained using the methods of the FAQBuilder class.

Instance method resume()

When an instance of the FAQ class is created, its corresponding FAQ list is in a suspended state. This method is required to kick off network activity.

It may throw errors like FAQAccessError. Required for the service to fully function in the context of the application.

Instance method pause()

A method that is used to pause network activity. If the FAQ list is already in a suspended state, the method does not perform any action.

May throw errors of type FAQAccessError. The FAQ list must not be in a deactivated state for the method to be called.

Instance method destroy()

A method that is used to deactivate the FAQ list and the class instance. Once this method is called, no methods can be used.

May throw errors like FAQAccessError.

Instance method getCategory(id:completionHandler:)

Method used to get an object of class FAQCategory via completionHandler.

The id parameter is the category ID of the FAQ block. The type is String.

The completionHandler parameter is a closure that is executed after the method execution is completed. If the method completes successfully, the closure takes one parameter of type FAQCategory, if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method getCategoriesForApplication(completionHandler:)

Method used to get an array of category IDs matching the given parameters via completionHandler. Only works when the application parameters are specified.

The completionHandler parameter is a closure that is executed when the method completes. If the method completes successfully, the closure accepts an array of category identifiers of type String; if unsuccessful, it accepts a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method getCachedCategory(id:completionHandler:)

Method used to retrieve an object of class FAQCategory via completionHandler from a stored cache.

The id parameter is the category ID of the FAQ block. The type is String.

The completionHandler parameter is a closure that is executed after the method execution is completed. If the method completes successfully, the closure takes one parameter of type FAQCategory, if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method getItem(id:openFrom:completionHandler:)

Method used to get an object of class FAQItem via completionHandler.

The id parameter is the page ID of the FAQ block. The type is String.

Parameter openFrom - article request from a certain source. Type - optional FAQItemSource.

The completionHandler parameter is a closure that is executed after the method completes. If the method completes successfully, the closure takes one parameter of type FAQItem, if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method getCachedItem(id:openFrom:completionHandler:)

Method used to retrieve an object of class FAQItem via completionHandler from the cache.

The id parameter is the page ID of the FAQ block. The type is String.

Parameter openFrom - request of an article from a certain source. Type - optional FAQItemSource.

The completionHandler parameter is a closure that is executed after the method completes. If the method completes successfully, the closure takes one parameter of type FAQItem, if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method funcgetStructure(id:completionHandler:)

Method used to get an object of class FAQStructure() via completionHandler.

The id parameter is the ID of the node that will be the root of the tree (structure) of the FAQ block. The type is String.

The completionHandler parameter is a closure that is executed after the method execution is completed. If the method completes successfully, the closure takes one parameter of type FAQStructure(), if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method getCachedStructure(id:completionHandler:)

Method used to retrieve an object of class FAQStructure() via completionHandler from the cache.

The id parameter is the ID of the node that will be the root of the tree (structure) of the FAQ block. The type is String.

Parameter completionHandler - closure, which is executed after the method execution is completed. If the method completes successfully, the closure takes one parameter of type FAQStructure(), if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method func like(item:completionHandler:)

A method that allows you to put a "like" mark for an article.

The item parameter is the page to be rated. The type is FAQItem.

Parameter completionHandler - a closure that is executed after the method completes. If the method completes successfully, the closure takes one parameter of type FAQItem, if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method dislike(item:completionHandler:)

A method that allows you to put a "dislike" mark for an article.

Important: the method requires a call to the resume() method to work properly.

The item parameter is the page to be rated. The type is FAQItem.

The completionHandler parameter is a closure that is executed after the method completes. If the method completes successfully, the closure takes one parameter of type FAQItem, if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.

Instance method search(query:category:limitOfItems:completionHandler:)

A method that searches for articles based on a keyword.

The query parameter is the query that is being searched. The type is String.

The category parameter is the ID of the category being searched. Type - String.

Parameter limitOfItems - the number not more than which articles should be returned.

Parameter completionHandler - closure, which is executed after the method execution is completed. If the method completes successfully, the closure takes one parameter of type FAQSearchItem, if unsuccessful, it takes a parameter of type FAQGetCompletionHandlerError, and has no return type.

The method requires a call to the resume() method to work properly.


Protocol FAQCategory

Representation of a category of a block of frequently asked questions. Provides methods for retrieving information about a category.FAQCategory objects can be retrieved using completionHandler in the getCategory(id:completion:) and getCachedCategory(id:completionHandler:) methods.

Instance method getID()

Returns the identifier of the category. The type is String.

Instance method getTitle()

Returns the title of the category. Type is String.

Instance method getItems()

The category contains the pages of the FAQ block.

Returns the pages belonging to the category. The type is FAQItem.

Instance method getSubcategories()

A category contains subcategories. For convenience, this method returns subcategory information without its pages and subcategories.

Returns information about subcategories belonging to a category. The type is FAQCategoryInfo.


Protocol FAQItem

Representation of the FAQ block page. Provides methods for retrieving information about the page. FAQItem objects can be retrieved from the completionHandler function getItem(id:completionHandler:).

Instance method getId().

Returns the identifier of the page. The type is String.

Instance method getTitle()

Returns the title of the page. Type is String.

Instance method getCategories()

A page can belong to multiple categories.

Returns the identifiers of the categories the page belongs to. The type is String.

Instance method getTags()

The page has a set of tags.

Returns a list of tags that the page is tagged with. The type is String.

Instance method getContent()

Returns the content of the page. Type is String.

Instance method getLikeCount()

The page contains the number of "Like" marks.

Returns the number of "Like" marks of the page. The type is Int.

Instance method getDislikeCount()

The page contains the number of "Dislike" marks.

Returns the number of "Dislike" marks of the page. The type is Int.

Instance method getUserRate()

The page can be marked by the user.

Returns the user's rating. The type is UserRate.


Protocol FAQCategoryInfo

Representation of the category information of the FAQ block. Provides methods to retrieve the category identifier and header. FAQCategoryInfo objects can be retrieved using the getSubcategories() method.

Instance method getID()

Returns the identifier of the category. The type is String.

Instance method getTitle()

Returns the title of the category. The type is String.


Protocol FAQSearchItem

A summary of the pages retrieved from a keyword search.

Instance method getID()

Returns the page identifier of the page. The type is String.

Instance method getTitle()

Returns the title of the page. Type is String.

Instance method getScore()

The page has a search score. The higher the score, the more the page matches the search query. Returns the search score. Type is Double.


Protocol FAQStructure

Representation of the tree (structure) of the FAQ block. Provides methods to retrieve information about the tree of the FAQ block.

FAQStructure objects can be retrieved using the completionHandler method getStructure(id:completionHandler:).

Instance method getID()

The tree has a root element.

Returns the identifier of the root element of the tree. The type is String.

Instance method getTitle()

Returns the title of the root element. Type is String.

Instance method getType()

The root of the tree can be a category or a page.

Returns the type of the root element. The type is RootType.

Instance method getChildren()

Returns subtrees whose roots are direct descendants of the root of the tree (structure). The type is FAQStructure.


Enumerated type UserRate

The page can be user-rated.

Case like

The user liked the page.

Case of dislike

The user did not like the page.

Case noRate

The page is not rated by the user.


Enumerated type FAQAccessError

The type value corresponds to errors that may be thrown by some FAQ protocol methods.

Case invalidThread

Occurs when a method was called from a thread other than the thread in which the FAQ block instance was created.

Case invalidFaq

Occurs when methods of an invalid instance of FAQ are attempted (e.g., after the destroy() method has been called on it).


Enumerated type FAQBuilderError

The type values correspond to possible errors that may occur when calling the build() method of the FAQBuilder class.

Case nilAccountName

Occurs when no account name value was passed in when creating the FAQ block.


Enumerated type FAQGetCompletionHandlerError

Possible errors that may be thrown by FAQ protocol methods.

Case ERROR

Error encountered.


Enumerated type FAQItemSource

The possible source of the article. The article can come from a search or from a structure or category.

The article is requested from a search.

Case tree

The article is requested from a structure or category.


Enumerated type RootType

Possible types of the root of the FAQ block tree (see the getType() method of the FAQStructure protocol).

Case item

The root of the tree is a page.

Case category

The root of the tree is a category.

Case unknown

The root of the tree has an unknown type for this version of the SDK.


Class SessionBuilder

Method set(prechat:)

A method that can be used to set fields with additional information that will be visible to the operator.

The prechat parameter is fields with additional information in JSON format. The parameter type is String.

Returns the same instance of the SessionBuilder class, but with the fields set. To get an instance of class RoxchatSession, calling the method is optional.

Method set(multivistorSection:)

Method to set the settings to receive push notifications from the Rox.Chat service when multiple sessions are running on the same device.

The multivisitorSection parameter type is String.

Returns the same instance of class SessionBuilder, but with the field set.

It is optional to call the method to get an instance of class RoxchatSession.

Method set(onlineStatusRequestFrequencyInMillis:)

A method to specify the frequency of requests to the server in milliseconds.

The onlineStatusRequestFrequencyInMillis parameter is Int64.

Returns the same instance of class SessionBuilder, but with the value of the corresponding option set manually.


Protocol RoxchatSession

Instance method change(location:)

This method is used to change the name of a location within an existing session. Calling the method is roughly analogous to the result of creating a new session with similar parameters, but with a different location name.

The location parameter is the name of the location to which the current session value should be changed. The type is String.

May throw errors like AccessError.

The session must not be in suspended or deactivated state to call the method (see methods resume(), pause() and destroy()).


Interface Message

Method getSticker()

Returns an object of type Sticker.

Throws no exceptions.

Method canVisitorReact()

Method returns true if the visitor can react to the message, otherwise returns false.

Does not throw exceptions.


Enumerated type AttachmentState

Case externalChecks

The file is checked by the server.


Interface MessageStream

Method rateOperatorWith(id:note:byRating:completionHandler:)

Use this method to send the operator rating of the current visitor with a comment.

The id parameter is the ID of the operator whose rating should be sent to the Rox.Chat service. The type is String. Optional: if you pass nil, the evaluation will be sent to the current chat operator (if any).

The note parameter is a comment to the operator's evaluation that should be sent to Rox.Chat service. Maximum length is 2000 characters. Type - optional String.

Parameter byRating - the operator's rating to be sent to Rox.Chat service. The rating must be an integer from 1 to 5 (if you specify otherwise, the method will not perform any actions). The type is Int.

The completionHandler parameter is a RateOperatorCompletionHandler object.

May throw errors like AccessError.

Warning!

Implementation of the mechanism of operator evaluation in chat is left to the developers of the mobile application!

Method respondSentryCall(id:)

Use this method to transfer the chat to the on-duty operator.

The id parameter is the ID of the message to transfer to the on-duty operator. The type is String.

May throw errors of type AccessError.

Method searchStreamMessagesBy(query:completionHandler:)

The method is used to search for a message in the history by query.

It may throw errors of type AccessError.

The query parameter is the query to search for. The type is String.

The completionHandler parameter is an object that implements the SearchMessagesCompletionHandler protocol methods. Type Optional.

Method set(prechatFields:)

Sends additional fields to the server.

May throw errors like AccessError.

Parameter prechatFields - additional fields. The type is String.

Method set(surveyListener:)

Use this method to set the SurveyListener object.

The surveyListener parameter is an object that implements the SurveyListener interface.

Method set(helloMessageListener)

Use this method to set the hello message.

The helloMessageListener parameter is an object that implements the HelloMessageListener interface.

Method send(message:data:completionHandler:)

The method is used to send a visitor's message to the Rox.Chat service.

The message parameter is the message to be sent. The type is String.

The maximum length of the message is 32000 characters. Longer messages will be cut off by the server when they are received.

The data parameter is used to send an arbitrary dictionary with message parameters to the server (if the server version supports this functionality). Dictionary keys should be of String type, values - of any "standard" type.

The completionHandler parameter is a DataMessageCompletionHandler object or nil.

Returns a randomly generated ID for this message, which can be used to identify this particular message within the application logic. The type is String.

May throw errors of type AccessError.

If MessageTracker and MessageListener objects exist, sending a message will invoke the [added(newMessage:previousMessage:)] method(ios-sdk-handbook. md#added-message-new-message-after-previous-message) protocol MessageListener with a new message with status SENDING of enumerated type MessageSendStatus.

Method send(uploadedFiles:completionHandler:)

Method to send uploaded files to the Rox.Chat server. The type is UploadedFile.

Parameter uploadedFile - list of files to be sent.

Parameter completionHandler - object implementing methods of the SendFilesCompletionHandler interface. The type is optional.

Method send(surveyAnswer:completionHandler:)

Use this method to send the answer to the current question received by the SurveyListener.on(nextQuestion: SurveyQuestion) method.

The surveyAnswer parameter is the answer, for a question of type 'stars', the answer will be an integer between 1 and 5 defining the operator's score. For a question of type 'radio', the answer is the index of the element in the options array starting from 1. For a question of type 'comment', the answer is a string representing the user's comment. The type is String.

May throw errors of type AccessError.

The completionHandler parameter is an object that implements the SendSurveyAnswerCompletionHandler protocol methods. Type Optional.

Method uploadFilesToServer(file:filename:mimeType:completionHandler:)

The file parameter is the file itself in Data format.

The filename parameter is the name of the file. The type is String.

Parameter mimeType - MIME-type of the transferred file. The type is String.

The completionHandler parameter is an object that implements the UploadFileToServerCompletionHandler protocol methods. Type Optional.

Method deleteUploadedFiles(fileGuid:completionHandler:)

Method to delete files from the Rox.Chat server.

The fileGuid parameter is the id of the file to be deleted. The type is String.

Parameter completionHandler - object that implements methods of protocol DeleteUploadedFileCompletionHandler. Type Optional.

Method sendSticker(withId:completionHandler:)

Use this method to send a sticker to a chat room.

The withId parameter is the ID of the sticker to be sent to the Rox.Chat service. The type is int.

Parameter completionHandler - object implementing the SendStickerCompletionHandler interface. Type Optional.

Method autocomplete(text:completionHandler)

The method returns a hint.

May throw errors like AccessError.

The text parameter is the hint text. The type is String.

The completionHandler parameter is an object that implements the AutocompleteCompletionHandler interface. The type is optional.

Method react(message:reaction:completionHandler:)

Method used to send the user's reaction to a message.

It may throw errors like AccessError.

The message parameter is the message to respond to. The type is Message.

The reaction parameter is the user's reaction. The type is ReactionString.

Parameter completionHandler - object that implements the protocol methods ReactionCompletionHandler. The type is optional.

Method updateWidgetStatus(data:)

The method is used to update the widget status.

It may throw errors like AccessError.

Parameter data - string in JSON format with new widget status. The type is String.

Method closeSurvey(completionHandler:)

Use this method to close the survey.

It may throw errors of type AccessError.

The completionHandler parameter is an object that implements the SurveyCloseCompletionHandler protocol methods. The type is optional.

Method sendGeolocation(latitude:longitude:completionHandler:)

Use this method to send geolocation to the server.

The parameter latitude is the latitude. The type is Double.

The longitude parameter is the longitude. Type - Double.

The completionHandler parameter is an object that implements the GeolocationCompletionHandler protocol methods. The type is optional.

Can throw errors like AccessError.

Method clearHistory()

The method is called when the user clears history.


Protocol Operator

Instance method getInfo()

Method allows you to get additional information about a particular operator.Returns additional information about a particular operator. The type is optional String.


Protocol SendFilesCompletionHandler

A protocol-object can be passed in the completionHandler parameter of the send(uploadedFiles:completionHandler:) method of the MessageStream protocol.

Instance method onSuccess(messageID:)

The method is called when files are successfully sent using the send(uploadedFiles:completionHandler:) method of the MessageStream protocol.

The messageid parameter is the ID of the corresponding message. The type is String.

Instance method onFailure(messageID:error:)

Called when the send(uploadedFiles:completionHandler:) protocol MessageStream method fails to send files.

The messageid parameter is the ID of the corresponding message. The type is String.

The error parameter - the error that prevented successful sending of the file. Type - SendFilesError.


Enumerated type SendFilesError

Possible errors that can be passed to the error parameter of the onFailure(messageID:error:) protocol SendFilesCompletionHandler method.

Case fileNotFound

File not found.

Case maxFilesCountPerMessage

Maximum number of files for the message.

Case unknown

Unknown error.


Protocol DeleteUploadedFileCompletionHandler

A protocol-guided object can be passed in the completionHandler parameter of the deleteUploadedFiles(fileGuid:completionHandler:) protocol MessageStream method.

Instance method onSuccess()

The method is called when a file is successfully deleted using the deleteUploadedFiles(fileGuid:completionHandler:) protocol MessageStream method.

Instance method onFailure(error:)

Called when deleting a file fails using the deleteUploadedFiles(fileGuid:completionHandler:) protocol MessageStream method.

The error parameter is the error that prevented the file from being sent successfully. Type - DeleteUploadedFileError.


Enumerated type DeleteUploadedFileError

Possible errors that can be passed to the error parameter of the onFailure(error:) method of the DeleteUploadedFileCompletionHandler protocol.

Case fileNotFound

File not found.

Case fileHasBeenSent

The file has been sent.

Case unknown

Unknown error.


Protocol SendStickerCompletionHandler

A protocol object can be passed in the completionHandler parameter of the send(message:completionHandler:) method of the MessageStream protocol.

Method onSuccess()

The method is called when a sticker is successfully sent using the sendSticker(withId:completionHandler:) protocol MessageStream method.

Method onFailure(error:)

Called when sending a sticker fails using the send(message:completionHandler:) method of the MessageStream protocol.

The error parameter is the error that prevented the file from being sent successfully. Type - SendStickerError.


Enumerated type SendStickerError

Possible errors that can be passed to the error parameter of the onFailure(error:) method of the SendStickerCompletionHandler protocol.

Case noChat

No chat was found.

Case noStickerId

No sticker ID has been set.


Protocol AutocompleteCompletionHandler

An object that obeys the protocol can be passed in the completionHandler parameter of the autocomplete(text:completionHandler) method of the MessageStream protocol.

Instance method onSuccess()

The method is called when the prompt is successfully sent using the autocomplete(text:completionHandler) protocol MessageStream method.

Instance method onFailure(error:)

Called when a prompt is sent unsuccessfully using the autocomplete(text:completionHandler) method of the MessageStream protocol.

The error parameter is the error that prevented the successful sending of the prompt. Type - AutocompleteError.


Enumerated type AutocompleteError

Case of hintApiInvalid

The endpoint API for visitor hints is not set or is not set correctly.

Case unknown

Unknown error


Protocol SurveyListener

An object that implements the protocol can be passed in the surveyListener parameter of the set(surveyListener:) method of the MessageStream protocol.

Instance method on(survey:)

This method is called when a new survey arrives from the server.

The survey parameter is the survey object. The type is Survey.

Instance method on(nextQuestion:)

This method is called in two cases: when you receive a survey immediately after calling on(survey:), and when you successfully answer the previous question of the current survey.

The nextQuestion parameter is the first/next question. The type is SurveyQuestion.

Instance method onSurveyCancelled()

This method is called when a survey is closed on the server.


Protocol SendSurveyAnswerCompletionHandler

An object implementing this protocol can be passed to the completionHandler parameter of the send(surveyAnswer:completionHandler:) method of the MessageStream protocol.

Instance method onSuccess()

Called when the method send(surveyAnswer:completionHandler:) of the MessageStream protocol succeeds.

Instance method onFailure(error:)

Called when the send(surveyAnswer:completionHandler:) method of the MessageStream protocol fails.

The error parameter is the error that prevented the method from calling successfully. The type is SendSurveyAnswerError.


Enumerated type SendSurveyAnswerError

Possible errors that can be passed to the error parameter when calling the SendSurveyAnswerCompletionHandler.onFailure(error:) method.

Case incorrectRadioValue

Occurs when an incorrect answer to a question of type 'radio' has been passed.

Case incorrectStarsValue

Occurs when an incorrect answer was passed to a question of type 'stars'.

Case incorrectSurveyID

Occurs when an invalid survey ID was passed in when trying to submit an answer to a question.

Case maxCommentLength_exceeded

Occurs when an answer to a comment' type question has been sent that exceeds the maximum allowed length.

Case noCurrentSurvey

Occurs when an attempt is made to submit a response to a question when the current survey on the server has already been closed or has not yet been started.

Case questionNotFound

The question was not found.

Case surveyDisabled

Occurs when attempting to submit an answer to a question when the polling feature is disabled on this server.

Case unknown

Unknown error.


Protocol SurveyCloseCompletionHandler

An object that implements this protocol can be passed to the completionHandler parameter of the closeSurvey(completionHandler:) method of the MessageStream protocol.

Instance method onSuccess()

Called when the call to the closeSurvey(completionHandler:) method of the MessageStream protocol succeeds.

Instance method onFailure(error:)

Called when the call to the closeSurvey(completionHandler:) method of the MessageStream protocol fails.

The error parameter is the error that prevented the method from calling successfully. Type - SurveyCloseError.


Enumerated type SurveyCloseError

Possible errors that can be passed to the error parameter when calling the SurveyCloseCompletionHandler.onFailure(error:) method.

Case incorrectSurveyID

Occurs when an incorrect survey ID was passed in when trying to close a survey.

Case noCurrentSurvey

Occurs when attempting to close a survey when the current survey on the server has already been closed or has not yet been started.

Case surveyDisabled

Occurs when trying to close a survey when the survey option is disabled on this server.

Case unknown

Unknown error.


Protocol GeolocationCompletionHandler

An object that implements this protocol can be passed to the completionHandler parameter of the sendGeolocation method of the MessageStream protocol.

Instance method onSuccess()

Called when the call to the sendGeolocation method of the MessageStream protocol succeeds.

Method onFailure(error:)

Called when the call to the sendGeolocation method of the MessageStream protocol fails.

The error parameter is the error that prevented the method from being called successfully. Type - GeolocationError.


Enumerated type GeolocationError

Possible errors that can be passed to the error parameter when calling the GeolocationCompletionHandler.onFailure(error:) method.

Case invalidGeolocation

Invalid geolocation data.

Case unknown

Unknown error.


Protocol HelloMessageListener

The protocol is an abstraction representing a hello message.

Instance method helloMessage(message:)

The method is called when a hello message is received before chat messages are received.

The message parameter is the hello message. The type is String.


Enumerated type ReactonString

Available reaction types.

Case like

A like rating.

Case dislike

A dislike rating.


Protocol ReactionCompletionHandler

A protocol-subject object can be passed in the completionHandler parameter of the react(message:reaction:completionHandler:) method of the MessageStream protocol.

Instance method onSuccess(messageID:)

The method is called on successful request by the react(message:reaction:completionHandler:) method of the MessageStream protocol.

The messageid parameter is the message ID. The type is String.

Instance method onFailure(error:)

Called when the react(message:reaction:completionHandler:) method request fails.

The error parameter is the error that prevented the method call from succeeding. The type is ReactionError.


Enumerated type ReactionError

Possible errors that can be passed to the onFailure(error:) method parameter of the ReactionCompletionHandler protocol.

Case notAllowed

Reactions are disabled on the server.

Case messageNotOwned

The user can only leave reactions to operator messages.

Case messageNotFound

Message not found.

Case unknown

Unknown error.


Enumerated type DataMessageError

Possible errors that can be passed to the error parameter of the onFailure(messageID:error:) method.

Case UNKNOWN

The received error code is not supported by this version of RoxchatClientLibrary.

Case QUOTED_MESSAGE_CANNOT_BE_REPLIED

The quoted message is not marked with the canBeReplied flag or the flag is not set to true.

Case QUOTED_MESSAGE_FROM_ANOTHER_VISITOR

The sent message ID corresponds to another visitor.

Case QUOTED_MESSAGE_MULTIPLE_IDS

The sent message ID corresponds to multiple messages (most likely there is a database error).

Case QUOTED_MESSAGE_REQUIRED_ARGUMENTS_MISSING

Indicates that one or more arguments of the server-implemented quoting system were not sent.

Case QUOTED_MESSAGE_WRONG_ID

An invalid ID of the quoted message was sent.


Protocol Survey

Contains methods that can be used to retrieve information about a survey.

Instance method getConfig()

Use this method to get the configuration of the survey.

It returns a value of type SurveyConfig.

Instance method getID()

Use this method to get the id of the survey.

It returns a value of type String.

Instance method getCurrentQuestionInfo()

Use this method to get information about the current question.

It returns a value of type SurveyCurrentQuestionInfo.


Protocol SurveyConfig

Contains methods that can be used to retrieve information about a survey.

Instance method getID()

Use this method to get the id of the survey configuration.

It returns a value of type Int.

Instance method getDescriptor()

Use this method to get the descriptor object for this survey.

It returns a value of type SurveyDescriptor.

Instance method getVersion()

Use this method to get the version information of the current survey configuration.

It returns a value of type String.


Protocol SurveyCurrentQuestionInfo

Contains methods that can be used to retrieve information about a survey.

Instance method getFormID()

Use this method to get the form ID of the current question.

It returns a value of type Int.

Instance method getQuestionID()

Use this method to get the index of the current question in the list of questions starting from 0, returned by the getQuestions() method.

It returns a value of type Int.


Protocol SurveyDescriptor

Contains methods that can be used to retrieve information about a survey.

Instance method getForms()

Use this method to get a list of the current survey's forms.

It returns a value of type SurveyForm.


Protocol SurveyForm

Contains methods that can be used to retrieve information about a survey.

Instance method getID()

Use this method to get the id of the form.

It returns a value of type Int.

Instance method getQuestions()

Use this method to get the list of questions of this form.

Returns a value of type SurveyQuestion.


Protocol SurveyQuestion

Contains methods that can be used to retrieve information about a survey.

Instance method getType()

Use this method to get the type of the given question.

It returns a value of type SurveyType.

Instance method getText()

Use this method to get the text of the question.

It returns a value of type String.

Instance method getOptions()

Use this method to get the answer options for the question.

It returns an optional value of type [String].


Enumerated type SurveyType

The types that can be obtained as a result of calling the getType() method on an object of type SurveyQuestion.

Case stars

A question in which the answer is a score.

Case radio

A question in which the answer is an option from a list of possible options.

Case comment

A question in which the answer is a user comment.


Protocol UploadFileToServerCompletionHandler

A protocol object can be passed in the completionHandler parameter of the uploadFilesToServer(file:filename:mimeType:completionHandler:) protocol MessageStream method.

Instance method onSuccess(id:uploadedFile:)

The method is called when a file is successfully uploaded using the uploadFilesToServer(file:filename:mimeType:completionHandler:) protocol MessageStream method.

The messageid parameter is the ID of the corresponding message. The type is String.

Parameter uploadedFile - the file uploaded to the server. The type is UploadedFile.

Method onFailure(messageID:error:)

Called when a file upload fails using the uploadFilesToServer(file:filename:mimeType:completionHandler:) protocol MessageStream method.

The messageid parameter is the ID of the corresponding message. The type is String.

The error parameter - the error that prevented successful sending of the file. Type - SendFileError.


Protocol KeyboardButton

Instance method getParams()

The method is used to get information about the chatbot keyboard button.

Returns a Params object or nil if no additional information is available.


Protocol Params

Contains information about the chatbot keyboard button.

Instance method getAction()

A method that can be used to get the action of a button in the chatbot keyboard.

Returns the action of the button. The type is an optional String.

Instance method getType()

A method by which the type of the button in the chatbot keyboard can be obtained.

Returns the type of the button. The type is optional ParamsButtonType.

Instance method getColor()

Method that can be used to get the color of a button in the chatbot keyboard.

Returns the color of the button. The type is an optional String.


Enumerated type ParamsButtonType

Possible chatbot keyboard button types returned by the Params.getType() method.

Case url

The button is a link.

Case action

The button is an action.