CreateSessionCommand

Creates a session. A session is a contextual container used for generating recommendations. Amazon Connect creates a new Amazon Q in Connect session for each contact on which Amazon Q in Connect is enabled.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { QConnectClient, CreateSessionCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, CreateSessionCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // CreateSessionRequest
  clientToken: "STRING_VALUE",
  assistantId: "STRING_VALUE", // required
  name: "STRING_VALUE", // required
  description: "STRING_VALUE",
  tags: { // Tags
    "<keys>": "STRING_VALUE",
  },
  tagFilter: { // TagFilter Union: only one key present
    tagCondition: { // TagCondition
      key: "STRING_VALUE", // required
      value: "STRING_VALUE",
    },
    andConditions: [ // AndConditions
      {
        key: "STRING_VALUE", // required
        value: "STRING_VALUE",
      },
    ],
    orConditions: [ // OrConditions
      { // OrCondition Union: only one key present
        andConditions: [
          "<TagCondition>",
        ],
        tagCondition: "<TagCondition>",
      },
    ],
  },
  aiAgentConfiguration: { // AIAgentConfigurationMap
    "<keys>": { // AIAgentConfigurationData
      aiAgentId: "STRING_VALUE", // required
    },
  },
};
const command = new CreateSessionCommand(input);
const response = await client.send(command);
// { // CreateSessionResponse
//   session: { // SessionData
//     sessionArn: "STRING_VALUE", // required
//     sessionId: "STRING_VALUE", // required
//     name: "STRING_VALUE", // required
//     description: "STRING_VALUE",
//     tags: { // Tags
//       "<keys>": "STRING_VALUE",
//     },
//     integrationConfiguration: { // SessionIntegrationConfiguration
//       topicIntegrationArn: "STRING_VALUE",
//     },
//     tagFilter: { // TagFilter Union: only one key present
//       tagCondition: { // TagCondition
//         key: "STRING_VALUE", // required
//         value: "STRING_VALUE",
//       },
//       andConditions: [ // AndConditions
//         {
//           key: "STRING_VALUE", // required
//           value: "STRING_VALUE",
//         },
//       ],
//       orConditions: [ // OrConditions
//         { // OrCondition Union: only one key present
//           andConditions: [
//             "<TagCondition>",
//           ],
//           tagCondition: "<TagCondition>",
//         },
//       ],
//     },
//     aiAgentConfiguration: { // AIAgentConfigurationMap
//       "<keys>": { // AIAgentConfigurationData
//         aiAgentId: "STRING_VALUE", // required
//       },
//     },
//   },
// };

CreateSessionCommand Input

See CreateSessionCommandInput for more details

Parameter
Type
Description
assistantId
Required
string | undefined

The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.

name
Required
string | undefined

The name of the session.

aiAgentConfiguration
Partial<Record<AIAgentType, AIAgentConfigurationData> | undefined

The configuration of the AI Agents (mapped by AI Agent Type to AI Agent version) that should be used by Amazon Q in Connect for this Session.

clientToken
string | undefined

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 .

description
string | undefined

The description.

tagFilter
TagFilter | undefined

An object that can be used to specify Tag conditions.

tags
Record<string, string> | undefined

The tags used to organize, track, or control access for this resource.

CreateSessionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
session
SessionData | undefined

The session.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient access to perform this action.

ConflictException
client

The request could not be processed because of conflict in the current state of the resource. For example, if you're using a Create API (such as CreateAssistant) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.

ResourceNotFoundException
client

The specified resource does not exist.

ValidationException
client

The input fails to satisfy the constraints specified by a service.

QConnectServiceException
Base exception class for all service exceptions from QConnect service.