ContactCustomFieldsProvider

public protocol ContactCustomFieldsProvider : Sendable

The provider for chat fields related properties and methods.

  • Custom fields for current chat case.

    Declaration

    Swift

    func get(for threadId: String) -> [String : String]

    Parameters

    threadId

    The unique identifier of the thread for the custom fields.

    Return Value

    Dictionary of custom fields for current chat case.

  • set(_:for:) Asynchronous

    Sets custom fields to be saved on a contact (specific thread).

    This method sets custom field(s) for a specific thread.

    Note

    Can be used to provide additional custom field(s) to the chat thread that are not part of the pre-chat survey.

    Important

    Additional custom field(s) must be defined in the channel configuration. Otherwise, the custom field(s) will cause the conversation initialization to fail.

    Throws

    notConnected if an attempt was made to use a method without connecting first. Make sure you call the connect method first.

    Throws

    customerAssociationFailure if the SDK could not get customer identity and it may not have been set.

    Throws

    invalidData when 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 set(_ customFields: [String : String], for threadId: String) async throws

    Parameters

    customFields

    The custom fields to be saved.

    threadId

    The unique identifier of the thread for the custom fields.