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
UnbluConversationInterceptor
for 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
conversationType
The initial type of the new conversation.
customVisitorData
Optional 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.conversationRecipient
The 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
UnbluConversationInterceptor
onComplete
A
Result
containing theUnbluConversation
that was started, or anUnbluApiInitConversationError
if 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
pin
The pin for the conversation to join. The pin is provided by the Agent Desk.
onComplete
A
Result
containing theUnbluConversation
of the conversation with the mobile co-browsing session that the visitor joined, or anUnbluApiInitConversationError
if 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
pin
The 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
onComplete
A
Result
reporting success withtrue
orfalse
to indicate whether an agent is available, or anUnbluApiNotInitializedError
if checking agent availability failed. -
Sets visitor data for the active conversation.
Declaration
Swift
func setVisitorData(data: String, onComplete: @escaping (Bool) -> Void)
Parameters
data
The visitor data to be set.
onComplete
A closure called upon completion. The closure receives a
Bool
indicating 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
data
The visitor data to be set.
onComplete
A closure called upon completion of the operation. The closure receives: -
result
: ABool
indicating whether the operation was successful (true
) or not (false
). -errorDescription
: An optionalString
providing details in case of failure.