UnbluVisitorClient
public 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: UnbluVisitorClientDelegate? { get set }
-
The
UnbluConversationInterceptor
for intercepting conversation-related events from Unblu.Declaration
Swift
var conversationInterceptor: 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<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<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<UnbluConversation, UnbluJoinConversationError>) -> 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 anUnbluJoinConversationError
if joining the mobile co-browsing session failed. -
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 (_ result: Bool) -> Void)
Parameters
data
The visitor data to be set.
onComplete
A closure that is called with a
Bool
indicating success (true
) or failure (false
) of the operation.