UnbluVisitorClient
protocol UnbluVisitorClient : UnbluClient
A protocol describing functionality of the UnbluVisitorClient. This inherits functionality from UnbluClient.
-
The delegate for Unblu related events
Declaration
Swift
var visitorDelegate: (any UnbluVisitorClientDelegate)? { get set } -
The
UnbluConversationInterceptorfor intercepting conversation-related events from Unblu.Declaration
Swift
var conversationInterceptor: (any UnbluConversationInterceptor)? { get set } -
Starts a new conversation of the given conversation type. If the UI is already visible, calling #startNewConversation will display the new conversation in the UI.
This is an asynchronous call. Use the callback to check for success or failure.
Declaration
Swift
func startNewConversation(conversationType: ConversationType, customVisitorData: String?, conversationRecipient: ConversationRecipient?, onComplete: @escaping (Result<any UnbluConversation, UnbluInitConversationError>) -> Void)Parameters
conversationTypeThe initial type of the new conversation.
customVisitorDataOptional String of contextual data to initialize the conversation with. The default value is
nil. This custom string is used to add additional information to the Visitor when integrating it with a bot or other external systems.conversationRecipientThe team or agent recipient of the conversation. This will overwrite any named area that might be set for this web page. NOTE: The data which is passed here could be used in
UnbluConversationInterceptoronCompleteA
Resultcontaining theUnbluConversationthat was started, or anUnbluApiInitConversationErrorif starting a conversation failed. -
Joins an Unblu mobile co-browsing session started by an agent. This is an asynchronous call. Use the callback to check for success or failure.
Declaration
Swift
@available(*, deprecated, message: "Use joinConversation with Result<UnbluConversation, UnbluJoinConversationError> instead") func joinConversation(pin: String, onComplete: @escaping (Result<any UnbluConversation, UnbluInitConversationError>) -> Void)Parameters
pinThe pin for the conversation to join. The pin is provided by the Agent Desk.
onCompleteA
Resultcontaining theUnbluConversationof the conversation with the mobile co-browsing session that the visitor joined, or anUnbluApiInitConversationErrorif joining the mobile co-browsing session failed. -
Joins an Unblu mobile co-browsing session started by an agent. This is an asynchronous call. Use the callback to check for success or failure.
Declaration
Swift
func joinConversation(pin: String, completion onComplete: @escaping (Result<any UnbluConversation, UnbluJoinConversationError>) -> Void)Parameters
pinThe pin for the conversation to join. The pin is provided by the Agent Desk.
-
Checks if at least one agent is available for mobile co-browsing or chat.
This is an asynchronous call. Use the callbacks to check for success or failure.
Declaration
Swift
func isAgentAvailable(onComplete: @escaping (Result<Bool, UnbluClientNotInitializedError>) -> Void)Parameters
onCompleteA
Resultreporting success withtrueorfalseto indicate whether an agent is available, or anUnbluApiNotInitializedErrorif checking agent availability failed. -
Sets visitor data for the active conversation.
Declaration
Swift
func setVisitorData(data: String, onComplete: @escaping (Bool) -> Void)Parameters
dataThe visitor data to be set.
onCompleteA closure called upon completion. The closure receives a
Boolindicating whether the operation was successful. -
Sets visitor data for the active conversation with detailed error information.
Declaration
Swift
func setVisitorDataWithError(data: String, onComplete: @escaping (Bool, String?) -> Void)Parameters
dataThe visitor data to be set.
onCompleteA closure called upon completion of the operation. The closure receives: -
result: ABoolindicating whether the operation was successful (true) or not (false). -errorDescription: An optionalStringproviding details in case of failure.