EPManager
public class EPManager : NSObject
This manager is the 86% SDK entry point.
-
If set to
true
it enables EightySixPercent logging.Declaration
Swift
public var enableLogs: Bool
-
If set to
true
it enables analytics sending to the Bot Editor.Declaration
Swift
public var enableAnalytics: Bool
-
The current EightySixPercent API version.
Declaration
Swift
public var apiVersion: Int
-
Initializes the EPManager. It must be called in order to have the bots working.
Declaration
Swift
public func initialize(delegate: EPManagerDelegate? = nil, enableLogs: Bool = false, enableAnalytics: Bool = true)
Parameters
delegate
The object that will receive the EPManager events.
enableLogs
If set to
true
the 86% SDK logs will be displayed in the console. Default value isfalse
.enableAnalytics
If set to
true
the 86% SDK will send analytics visible on the Bot Editor. Default value istrue
. -
Clears all chat conversations and associated data. To be called, for example, when you log a user out.
Declaration
Swift
public func clearData()
-
Registers a new bot to the EPManager.
Declaration
Swift
public func registerBot(uuid: String, fetchingStrategy: EPBotFetchingStrategy)
Parameters
uuid
The UUID of the bot to register.
fetchingStrategy
The fetching strategy to use to get the bot when you’re about to open a controller.
-
Creates a view controller for the given chat conversation and appearance.
Declaration
Swift
public func controller(for conversation: EPChatConversation, appearance: EPAppearance , delegate: EPChatMessageViewControllerDelegate? = nil, completion: @escaping (_ controller: EPChatMessageViewController?, _ error: Error?) -> ())
Parameters
conversation
The chat conversation to display in the controller.
appearance
The appearance to use with this controller. Default value is
nil
.delegate
The delegate to use for the controller provided in the callback. Default value is
nil
.completion
Callback called when the chat conversation controller is ready to be used.
controller
The controller that has been initialized for the given chat conversation and appearance,
nil
if an error occurred. (optional)error
The error that happened preparing the conversation and/or the controller,
nil
if no errors were raised. (optional)
-
Get an existing chat conversation for a given id.
Declaration
Swift
public func getChatConversation(forId id: String) -> EPChatConversation?
Parameters
id
The id of the existing chat conversation to get.
Return Value
The matching chat conversation object or
nil
if it was not found.
-
Runs a bot on the given chat conversation.
Declaration
Swift
public func runBotOnChatConversation(chatConversation: EPChatConversation, botUuid: String, contextUpdate: [EPContextObject] = [], replaceContext: Bool = false, completion: @escaping (_ error: Error?) -> ())
Parameters
chatConversation
The chat conversation on which to run the bot.
botUuid
The UUID of the bot to run.
contextUpdate
An array of context objects to use to update the chat conversation context. Default value is
[]
.replaceContext
If set to
true
, the current conversation context will first be cleared before add the given context objects.completion
Called when the bot has been started on the chat conversation.
error
The error that occurred when trying to start the bot.