SMIConversationClient
Objective-C
@protocol SMIConversationClient
Swift
protocol ConversationClient
Class that allows you to perform actions related to a conversation and to listen for events using the associated delegate.
-
The identifier for the conversation managed by this client.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSUUID *_Nonnull identifier;
Swift
var identifier: UUID { get }
-
Reference to the core object which manages this client.
Declaration
Objective-C
@property (nonatomic, weak, readonly) id<SMICoreClient> _Nullable core;
-
Sends a message with the contents of the message parameter.
Declaration
Objective-C
- (void)sendMessage:(nonnull NSString *)message;
Swift
func send(message: String)
Parameters
message
The message to send.
-
Deprecated
Will be removed in a future version. Use
sendImage:fileName:
Sends an image with the contents of the image parameter.
Declaration
Objective-C
- (void)sendImage:(nonnull UIImage *)image;
Swift
func send(image: UIImage)
Parameters
image
The image to send.
-
Sends an image with the contents of the data parameter.
Declaration
Objective-C
- (void)sendImage:(nonnull NSData *)data fileName:(NSString *_Nullable)fileName;
Swift
func send(image data: Data, fileName: String?)
Parameters
data
The data representation of an image.
fileName
The file name, if one exists, for the image that is being sent.
-
Sends an PDF attachment.
Declaration
Objective-C
- (void)sendPDF:(nonnull PDFDocument *)pdf;
Swift
func send(pdf: PDFDocument)
Parameters
pdf
The PDF document to send.
-
Sends a reply to a structured content message.
Declaration
Objective-C
- (void)sendReply:(nonnull id<SMIChoice>)reply;
Parameters
reply
The selected option for the structured content.
-
Attempts to send a typing indicator.
Note
There’s a predefined threshold for how often typing indicators are sent. It’s safe to call this method as often as needed. Attempts to send an indicator too frequently are ignored.Declaration
Objective-C
- (void)sendTypingEvent;
Swift
func sendTypingEvent()
-
Retrieves messages for this conversation. Only returns the first subset of messages. This is a convenience method to make direct database calls for entries associated with this conversation.
Declaration
Objective-C
- (void)entriesWithCompletion:(nonnull SMIFullQueryCompletion)completion;
Parameters
completion
The completion that contains the result of the search query.
-
Retrieves the conversation represented by the client.
Declaration
Objective-C
- (void)conversationWithCompletion: (nonnull SMISingleConversationQueryCompletion)completion;
Parameters
completion
The completion that contains the stored conversation record.
-
Submits collected pre-chat fields. Will immediately attempt to create a conversation if required.
Declaration
Objective-C
- (void)submitPreChatFields: (nonnull NSArray<id<SMIPreChatField>> *)preChatFields;
Parameters
preChatFields
An array of
SMIPreChatField
objects representing any collected pre-chat data. -
Submits collected pre-chat fields. Will immediately attempt to create a conversation if required.
Declaration
Objective-C
- (void)submitPreChatFields: (nonnull NSArray<id<SMIPreChatField>> *)preChatFields hiddenPreChatFields: (nonnull NSArray<id<SMIHiddenPreChatField>> *)hiddenPreChatFields;
Parameters
preChatFields
An array of
SMIPreChatField
objects representing any collected pre-chat data.hiddenPreChatFields
An array of
SMIHiddenPreChatField
objects representing any hidden prechat data -
Submits collected pre-chat fields. Only starts the convertsation if
createConversationOnSubmit
is true. Otherwise, the SDK holds onto the pre-chat data for later conversation creation.Declaration
Objective-C
- (void)submitPreChatFields: (nonnull NSArray<id<SMIPreChatField>> *)preChatFields hiddenPreChatFields: (nonnull NSArray<id<SMIHiddenPreChatField>> *)hiddenPreChatFields createConversationOnSubmit:(BOOL)createConversationOnSubmit;
Parameters
preChatFields
An array of
SMIPreChatField
objects representing any collected pre-chat data.hiddenPreChatFields
An array of
SMIHiddenPreChatField
objects representing any hidden pre-chat data.createConversationOnSubmit
Determines if the conversation should be started when submitting the pre-chat data.
-
Deprecated
Will be removed in a future version. Use
entriesWithLimit:olderThanEntry:completion:
Retrieves entries for this conversation. This is a convenience method to make direct database calls for entries associated with this conversation.
Declaration
Objective-C
- (void)entriesWithLimit:(NSUInteger)limit offset:(NSUInteger)offset completion:(nonnull SMIFullQueryCompletion)completion;
Parameters
limit
The maximum number of results to expect.
offset
The offset to begin searching for results.
completion
The completion that contains the result of the search query.
-
Retrieves entries for this conversation. This is a convenience method to make direct database calls for entries associated with this conversation.
Declaration
Objective-C
- (void)entriesWithLimit:(NSUInteger)limit olderThanEntry:(nullable id<SMIConversationEntry>)olderThanEntry completion:(nonnull SMIFullQueryCompletion)completion;
Parameters
limit
The maximum number of results to expect.
olderThanEntry
The comparison entry which serves as a base for returning older entries in the conversation.
completion
The completion that contains the result of the search query.
-
Adds a delegate to listen to
SMIConversationClientDelegate
events.Declaration
Objective-C
- (void)addDelegate:(nonnull id<SMIConversationClientDelegate>)delegate;
Swift
func addDelegate(delegate: ConversationClientDelegate)
Parameters
delegate
The delegate to add.
-
Adds a delegate to listen to
SMIConversationClientDelegate
events. It is recommended that the main queue is passed to this method if you plan to handle events directly with changes to the UI.Declaration
Objective-C
- (void)addDelegate:(nonnull id<SMIConversationClientDelegate>)delegate queue:(nonnull dispatch_queue_t)queue;
Swift
func addDelegate(delegate: ConversationClientDelegate, queue: DispatchQueue)
Parameters
delegate
The delegate to add.
queue
The dispatch queue to listen for events.
-
Removes the delegate to stop receiving events.
Declaration
Objective-C
- (void)removeDelegate:(nonnull id<SMIConversationClientDelegate>)delegate;
Swift
func removeDelegate(delegate: ConversationClientDelegate)
Parameters
delegate
The delegate to remove.