createSession method
Creates a session. A session is a contextual container used for generating recommendations. Amazon Connect creates a new Wisdom session for each contact on which Wisdom is enabled.
May throw ConflictException.
May throw ResourceNotFoundException.
May throw ValidationException.
Parameter assistantId :
The identifier of the Wisdom assistant. Can be either the ID or the ARN.
URLs cannot contain the ARN.
Parameter name :
The name of the session.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. If not provided, the Amazon Web Services SDK
populates this field. For more information about idempotency, see Making
retries safe with idempotent APIs.
Parameter description :
The description.
Parameter tags :
The tags used to organize, track, or control access for this resource.
Implementation
Future<CreateSessionResponse> createSession({
required String assistantId,
required String name,
String? clientToken,
String? description,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'name': name,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/assistants/${Uri.encodeComponent(assistantId)}/sessions',
exceptionFnMap: _exceptionFns,
);
return CreateSessionResponse.fromJson(response);
}