ChatThreadProvider
public protocol ChatThreadProvider : Sendable
The provider for message related properties and methods.
-
The delegate for the chat thread provider.
Declaration
Swift
var chatThread: ChatThread { get } -
loadMoreMessages()AsynchronousLoads additional messages in the thread.
Throws
notConnectedif an attempt was made to use a method without connecting first. Make sure you call theconnectmethod first.Throws
noMoreMessagesif there aren’t any other messages, so additional messages could not be loaded.Throws
invalidOldestDateif Thread is missing the timestamp of when the message was created.Throws
customerAssociationFailureif the SDK could not get customer identity and it may not have been set.Throws
invalidDatawhen the Data object cannot be successfully converted to a valid UTF-8 stringThrows
eventTimeoutif the SDK did not receive a response within the specified time.Throws
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Declaration
Swift
func loadMoreMessages() async throws -
send(_:Asynchronous) Sends a message in the chat thread through CXone chat.
Throws
illegalChatStateif the chat thread is already closed.Throws
attachmentErrorif the provided attachment was unable to be sent.Throws
notConnectedif an attempt was made to use a method without connecting first. Make sure you call theconnectmethod first.Throws
customerAssociationFailureif the SDK could not get customer identity and it may not have been set.Throws
missingParameter(_:)if attachments uploadurlhas not been set properly or attachment uploaded data object is missing.Throws
serverErrorif the server experienced an internal error and was unable to perform the action.Throws
invalidParameter(_:)if the outbound message has nopostback, emptytext, and emptyattachments.Throws
invalidFileSizeif size of the attachment exceeds the allowed sizeThrows
invalidFileTypeif type of the attachment is not included in the allowed file MIME typeThrows
invalidDataif the conversion from object instance to data failed or when the Data object cannot be successfully converted to a valid UTF-8 stringThrows
eventTimeoutif the SDK did not receive a response within the specified time.Throws
invalidAccessTokenif the credential needs a refresh but nothing is available to perform it — no registered token delegate listener for the implicit flow, or no socket delegate at all.Throws
invalidRefreshToken(_:)if the explicit-PKCE credential was expired and the refresh grant to renew it was rejected — the app must re-authenticate before it can send again.Throws
transactionTokenRequestFailed(statusCode:)if the explicit-PKCE credential was expired and renewing it failed for any other reason.Throws
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Throws
URLError.badServerResponseif the URL Loading system received bad data from the server.Throws
NSErrorobject that indicates why the request failedThrows
An error in the Cocoa domain, if
urlcannot be read.Throws
An error if any value throws an error during encoding.
Declaration
Swift
func send(_ message: OutboundMessage) async throwsParameters
messageThe content of the message.
-
updateName(_:Asynchronous) Updates the name for the thread.
Warning
Should only be used on a channel configured for multiple threads.
Throws
notConnectedif an attempt was made to use a method without connecting first. Make sure you call theconnectmethod first.Throws
unsupportedChannelConfigif the method being called is not supported with the current channel configuration.Throws
invalidThreadif the provided ID for the thread was invalid, so the action could not be performed.Throws
illegalThreadStateif the chat thread is not in the correct state.Throws
invalidDatawhen the Data object cannot be successfully converted to a valid UTF-8 stringThrows
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Declaration
Swift
func updateName(_ name: String) async throwsParameters
nameThe new name for the thread.
-
archive()AsynchronousArchives the thread from the list of all threads.
Warning
Should only be used on a channel configured for multiple threads.
Throws
notConnectedif an attempt was made to use a method without connecting first. Make sure you call theconnectmethod first.Throws
illegalChatStateif the chat thread is already closed.Throws
customerAssociationFailureif the SDK could not get customer identity and it may not have been set.Throws
unsupportedChannelConfigif the method being called is not supported with the current channel configuration.Throws
invalidThreadif the provided ID for the thread was invalid, so the action could not be performed.Throws
invalidDatawhen the Data object cannot be successfully converted to a valid UTF-8 stringThrows
eventTimeoutif the SDK did not receive a response within the specified time.Throws
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Throws
An error if the backend rejects the archive request.
Declaration
Swift
func archive() async throws -
markRead()AsynchronousReports that the most recent message of the specified thread was read by the customer.
Throws
notConnectedif an attempt was made to use a method without connecting first. Make sure you call theconnectmethod first.Throws
customerAssociationFailureif the SDK could not get customer identity and it may not have been set.Throws
invalidDatawhen the Data object cannot be successfully converted to a valid UTF-8 stringThrows
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Declaration
Swift
func markRead() async throws -
endContact()AsynchronousInvoke this when the customer wishes to end conversation.
Warning
Should only be used on a channel configured for live chat.
Throws
notConnectedif an attempt was made to use a method without connecting first. Make sure you call theconnectmethod first.Throws
illegalChatStateif the channel is not configured for live chat.Throws
customerAssociationFailureif the SDK could not get customer identity and it may not have been set.Throws
missingParameter(_:)if thecontactIdhas not been set properly or it was unable to unwrap it as a required type.Throws
invalidDatawhen the Data object cannot be successfully converted to a valid UTF-8 string.Throws
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Declaration
Swift
func endContact() async throws -
reportTypingStart(_:Asynchronous) Reports that the customer has started or finished typing in the specified chat thread.
Throws
notConnectedif an attempt was made to use a method without connecting first. Make sure you call theconnectmethod first.Throws
customerAssociationFailureif the SDK could not get customer identity and it may not have been set.Throws
illegalThreadStateif the chat thread is not in the correct state.Throws
invalidDatawhen the Data object cannot be successfully converted to a valid UTF-8 stringThrows
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Declaration
Swift
func reportTypingStart(_ didStart: Bool) async throwsParameters
didStartIndicator for start of finish typing.
-
sendTranscript(to:Asynchronous) Sends a transcript to the specified email address.
This method validates the email and initiates delivery of the conversation transcript.
Throws
notConnectedIf the method is called before establishing a connection. Ensure you call theconnect()method first.Throws
illegalThreadStateIf the chat thread is not in the correct state.Throws
sendTranscriptFailedIf the feature is disabled, the provided email is invalid, or an error occurs on the backend.Throws
missingParameter(_:)IfcontactIDis not set properly.Throws
customerAssociationFailureIf the SDK cannot retrieve the customer identity, which may not have been set.Declaration
Swift
func sendTranscript(to email: String) async throwsParameters
emailThe recipient’s email address.
View on GitHub