MessageRequest

public struct MessageRequest : Codable, Equatable

A stateful message request formatted for the Watson Assistant service.

  • An input object that includes the input text.

    Declaration

    Swift

    public var input: MessageInput?
  • Context data for the conversation. You can use this property to set or modify context variables, which can also be accessed by dialog nodes. The context is stored by the assistant on a per-session basis. Note: The total size of the context data stored for a stateful session cannot exceed 100KB.

    Declaration

    Swift

    public var context: MessageContext?
  • A string value that identifies the user who is interacting with the assistant. The client must provide a unique identifier for each individual end user who accesses the application. For user-based plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage return, newline, or tab characters. If no value is specified in the input, user_id is automatically set to the value of context.global.session_id. Note: This property is the same as the user_id property in the global system context. If user_id is specified in both locations, the value specified at the root is used.

    Declaration

    Swift

    public var userID: String?
  • Initialize a MessageRequest with member variables.

    Declaration

    Swift

    public init(
        input: MessageInput? = nil,
        context: MessageContext? = nil,
        userID: String? = nil
    )

    Parameters

    input

    An input object that includes the input text.

    context

    Context data for the conversation. You can use this property to set or modify context variables, which can also be accessed by dialog nodes. The context is stored by the assistant on a per-session basis. Note: The total size of the context data stored for a stateful session cannot exceed 100KB.

    userID

    A string value that identifies the user who is interacting with the assistant. The client must provide a unique identifier for each individual end user who accesses the application. For user-based plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage return, newline, or tab characters. If no value is specified in the input, user_id is automatically set to the value of context.global.session_id. Note: This property is the same as the user_id property in the global system context. If user_id is specified in both locations, the value specified at the root is used.

    Return Value

    An initialized MessageRequest.