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 *identifier;

    Swift

    var identifier: UUID! { get }
  • Reference to the core object which manages this client.

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly) id<SMICoreClient> core;
  • Sends a message with the contents of the message parameter.

    Declaration

    Objective-C

    - (void)sendMessage:(NSString *)message;

    Swift

    func send(message: String!)

    Parameters

    message

    The message to send.

  • Sends an image with the contents of the image parameter.

    Declaration

    Objective-C

    - (void)sendImage:(UIImage *)image;

    Swift

    func send(image: UIImage!)

    Parameters

    image

    The image to send.

  • Sends an PDF attachment

    Declaration

    Objective-C

    - (void)sendPDF:(PDFDocument *)pdf;

    Swift

    func send(pdf: PDFDocument!)

    Parameters

    pdf

    The pdf to send.

  • Sends a reply to a structured content message.

    Declaration

    Objective-C

    - (void)sendReply:(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. The default number of responses is defined by SMIStoreDefaultLimit. This is a convenience method to make direct database calls for entries associated with this conversation.

    See

    -[SMIStore entriesWithConversationId:completion:]

    Declaration

    Objective-C

    - (void)entriesWithCompletion:(__strong 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:
        (__strong 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:(NSArray<id<SMIPreChatField>> *)preChatFields;

    Parameters

    preChatFields

    An array of SMIPreChatField objects representing any collected pre-chat data.

  • Retrieves entries for this conversation. This is a convenience method to make direct DB calls for entries associated with this conversation.

    See

    [SMIStore messagesWithConversationId:limit:offset:completion:]

    Declaration

    Objective-C

    - (void)entriesWithLimit:(NSUInteger)limit
                      offset:(NSUInteger)offset
                  completion:(__strong 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.

  • Adds a delegate to listen to SMIConversationClientDelegate events.

    Declaration

    Objective-C

    - (void)addDelegate:(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:(id<SMIConversationClientDelegate>)delegate
                  queue:(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:(id<SMIConversationClientDelegate>)delegate;

    Swift

    func removeDelegate(delegate: ConversationClientDelegate!)

    Parameters

    delegate

    The delegate to remove.