AWS SDK for JavaScript Connect Client for Node.js, Browser and React Native
npm install @aws-sdk/client-connectAWS SDK for JavaScript Connect Client for Node.js, Browser and React Native.
Amazon Connect is a cloud-based contact center solution that you use to set up and manage a customer contact
center and provide reliable customer engagement at any scale.
Amazon Connect provides metrics and real-time reporting that enable you to optimize contact routing. You can
also resolve customer issues more efficiently by getting customers in touch with the appropriate agents.
There are limits to the number of Amazon Connect resources that you can create. There are also limits to the
number of requests that you can make per second. For more information, see Amazon Connect Service Quotas in the
Amazon Connect Administrator Guide.
You can use an endpoint to connect programmatically to an Amazon Web Services service. For a list of Amazon Connect endpoints, see Amazon Connect
Endpoints.
npm install @aws-sdk/client-connectyarn add @aws-sdk/client-connectpnpm add @aws-sdk/client-connectThe AWS SDK is modulized by clients and commands.
To send a request, you only need to import the ConnectClient and
the commands you need, for example ListInstancesCommand:
``js`
// ES5 example
const { ConnectClient, ListInstancesCommand } = require("@aws-sdk/client-connect");
`ts`
// ES6+ example
import { ConnectClient, ListInstancesCommand } from "@aws-sdk/client-connect";
To send a request, you:
- Initiate client with configuration (e.g. credentials, region).
- Initiate command with input parameters.
- Call send operation on client with command object as input.destroy()
- If you are using a custom http handler, you may call to close open connections.
`js
// a client can be shared by different commands.
const client = new ConnectClient({ region: "REGION" });
const params = { /* input parameters / };
const command = new ListInstancesCommand(params);
`
#### Async/await
We recommend using await
operator to wait for the promise returned by send operation as follows:
`js`
// async/await.
try {
const data = await client.send(command);
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}
Async-await is clean, concise, intuitive, easy to debug and has better error handling
as compared to using Promise chains or callbacks.
#### Promises
You can also use Promise chaining
to execute send operation.
`js`
client.send(command).then(
(data) => {
// process data.
},
(error) => {
// error handling.
}
);
Promises can also be called using .catch() and .finally() as follows:
`js`
client
.send(command)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
})
.finally(() => {
// finally.
});
#### Callbacks
We do not recommend using callbacks because of callback hell,
but they are supported by the send operation.
`js`
// callbacks.
client.send(command, (err, data) => {
// process err and data.
});
#### v2 compatible style
The client can also send requests using v2 compatible style.
However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post
on modular packages in AWS SDK for JavaScript
`ts
import * as AWS from "@aws-sdk/client-connect";
const client = new AWS.Connect({ region: "REGION" });
// async/await.
try {
const data = await client.listInstances(params);
// process data.
} catch (error) {
// error handling.
}
// Promises.
client
.listInstances(params)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
});
// callbacks.
client.listInstances(params, (err, data) => {
// process err and data.
});
`
When the service returns an exception, the error will include the exception information,
as well as response metadata (e.g. request id).
`js`
try {
const data = await client.send(command);
// process data.
} catch (error) {
const { requestId, cfId, extendedRequestId } = error.$metadata;
console.log({ requestId, cfId, extendedRequestId });
/**
* The keys within exceptions are also parsed.
* You can access them by specifying exception names:
* if (error.name === 'SomeServiceException') {
* const value = error.specialKeyInException;
* }
*/
}
Please use these community resources for getting help.
We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.
- Visit Developer Guide
or API Reference.
- Check out the blog posts tagged with aws-sdk-js
on AWS Developer Blog.
- Ask a question on StackOverflow and tag it with aws-sdk-js.
- Join the AWS JavaScript community on gitter.
- If it turns out that you may have found a bug, please open an issue.
To test your universal JavaScript code in Node.js, browser and react-native environments,
visit our code samples repo.
This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-connect` package is updated.
To contribute to client you can check our generate clients scripts.
This SDK is distributed under the
Apache License, Version 2.0,
see LICENSE for more information.
ActivateEvaluationForm
Command API Reference / Input / Output
AssociateAnalyticsDataSet
Command API Reference / Input / Output
AssociateApprovedOrigin
Command API Reference / Input / Output
AssociateBot
Command API Reference / Input / Output
AssociateContactWithUser
Command API Reference / Input / Output
AssociateDefaultVocabulary
Command API Reference / Input / Output
AssociateEmailAddressAlias
Command API Reference / Input / Output
AssociateFlow
Command API Reference / Input / Output
AssociateHoursOfOperations
Command API Reference / Input / Output
AssociateInstanceStorageConfig
Command API Reference / Input / Output
AssociateLambdaFunction
Command API Reference / Input / Output
AssociateLexBot
Command API Reference / Input / Output
AssociatePhoneNumberContactFlow
Command API Reference / Input / Output
AssociateQueueQuickConnects
Command API Reference / Input / Output
AssociateRoutingProfileQueues
Command API Reference / Input / Output
AssociateSecurityKey
Command API Reference / Input / Output
AssociateSecurityProfiles
Command API Reference / Input / Output
AssociateTrafficDistributionGroupUser
Command API Reference / Input / Output
AssociateUserProficiencies
Command API Reference / Input / Output
AssociateWorkspace
Command API Reference / Input / Output
BatchAssociateAnalyticsDataSet
Command API Reference / Input / Output
BatchCreateDataTableValue
Command API Reference / Input / Output
BatchDeleteDataTableValue
Command API Reference / Input / Output
BatchDescribeDataTableValue
Command API Reference / Input / Output
BatchDisassociateAnalyticsDataSet
Command API Reference / Input / Output
BatchGetAttachedFileMetadata
Command API Reference / Input / Output
BatchGetFlowAssociation
Command API Reference / Input / Output
BatchPutContact
Command API Reference / Input / Output
BatchUpdateDataTableValue
Command API Reference / Input / Output
ClaimPhoneNumber
Command API Reference / Input / Output
CompleteAttachedFileUpload
Command API Reference / Input / Output
CreateAgentStatus
Command API Reference / Input / Output
CreateContact
Command API Reference / Input / Output
CreateContactFlow
Command API Reference / Input / Output
CreateContactFlowModule
Command API Reference / Input / Output
CreateContactFlowModuleAlias
Command API Reference / Input / Output
CreateContactFlowModuleVersion
Command API Reference / Input / Output
CreateContactFlowVersion
Command API Reference / Input / Output
CreateDataTable
Command API Reference / Input / Output
CreateDataTableAttribute
Command API Reference / Input / Output
CreateEmailAddress
Command API Reference / Input / Output
CreateEvaluationForm
Command API Reference / Input / Output
CreateHoursOfOperation
Command API Reference / Input / Output
CreateHoursOfOperationOverride
Command API Reference / Input / Output
CreateInstance
Command API Reference / Input / Output
CreateIntegrationAssociation
Command API Reference / Input / Output
CreateParticipant
Command API Reference / Input / Output
CreatePersistentContactAssociation
Command API Reference / Input / Output
CreatePredefinedAttribute
Command API Reference / Input / Output
CreatePrompt
Command API Reference / Input / Output
CreatePushNotificationRegistration
Command API Reference / Input / Output
CreateQueue
Command API Reference / Input / Output
CreateQuickConnect
Command API Reference / Input / Output
CreateRoutingProfile
Command API Reference / Input / Output
CreateRule
Command API Reference / Input / Output
CreateSecurityProfile
Command API Reference / Input / Output
CreateTaskTemplate
Command API Reference / Input / Output
CreateTestCase
Command API Reference / Input / Output
CreateTrafficDistributionGroup
Command API Reference / Input / Output
CreateUseCase
Command API Reference / Input / Output
CreateUser
Command API Reference / Input / Output
CreateUserHierarchyGroup
Command API Reference / Input / Output
CreateView
Command API Reference / Input / Output
CreateViewVersion
Command API Reference / Input / Output
CreateVocabulary
Command API Reference / Input / Output
CreateWorkspace
Command API Reference / Input / Output
CreateWorkspacePage
Command API Reference / Input / Output
DeactivateEvaluationForm
Command API Reference / Input / Output
DeleteAttachedFile
Command API Reference / Input / Output
DeleteContactEvaluation
Command API Reference / Input / Output
DeleteContactFlow
Command API Reference / Input / Output
DeleteContactFlowModule
Command API Reference / Input / Output
DeleteContactFlowModuleAlias
Command API Reference / Input / Output
DeleteContactFlowModuleVersion
Command API Reference / Input / Output
DeleteContactFlowVersion
Command API Reference / Input / Output
DeleteDataTable
Command API Reference / Input / Output
DeleteDataTableAttribute
Command API Reference / Input / Output
DeleteEmailAddress
Command API Reference / Input / Output
DeleteEvaluationForm
Command API Reference / Input / Output
DeleteHoursOfOperation
Command API Reference / Input / Output
DeleteHoursOfOperationOverride
Command API Reference / Input / Output
DeleteInstance
Command API Reference / Input / Output
DeleteIntegrationAssociation
Command API Reference / Input / Output
DeletePredefinedAttribute
Command API Reference / Input / Output
DeletePrompt
Command API Reference / Input / Output
DeletePushNotificationRegistration
Command API Reference / Input / Output
DeleteQueue
Command API Reference / Input / Output
DeleteQuickConnect
Command API Reference / Input / Output
DeleteRoutingProfile
Command API Reference / Input / Output
DeleteRule
Command API Reference / Input / Output
DeleteSecurityProfile
Command API Reference / Input / Output
DeleteTaskTemplate
Command API Reference / Input / Output
DeleteTestCase
Command API Reference / Input / Output
DeleteTrafficDistributionGroup
Command API Reference / Input / Output
DeleteUseCase
Command API Reference / Input / Output
DeleteUser
Command API Reference / Input / Output
DeleteUserHierarchyGroup
Command API Reference / Input / Output
DeleteView
Command API Reference / Input / Output
DeleteViewVersion
Command API Reference / Input / Output
DeleteVocabulary
Command API Reference / Input / Output
DeleteWorkspace
Command API Reference / Input / Output
DeleteWorkspaceMedia
Command API Reference / Input / Output
DeleteWorkspacePage
Command API Reference / Input / Output
DescribeAgentStatus
Command API Reference / Input / Output
DescribeAuthenticationProfile
Command API Reference / Input / Output
DescribeContact
Command API Reference / Input / Output
DescribeContactEvaluation
Command API Reference / Input / Output
DescribeContactFlow
Command API Reference / Input / Output
DescribeContactFlowModule
Command API Reference / Input / Output
DescribeContactFlowModuleAlias
Command API Reference / Input / Output
DescribeDataTable
Command API Reference / Input / Output
DescribeDataTableAttribute
Command API Reference / Input / Output
DescribeEmailAddress
Command API Reference / Input / Output
DescribeEvaluationForm
Command API Reference / Input / Output
DescribeHoursOfOperation
Command API Reference / Input / Output
DescribeHoursOfOperationOverride
Command API Reference / Input / Output
DescribeInstance
Command API Reference / Input / Output
DescribeInstanceAttribute
Command API Reference / Input / Output
DescribeInstanceStorageConfig
Command API Reference / Input / Output
DescribePhoneNumber
Command API Reference / Input / Output
DescribePredefinedAttribute
[Command API Reference](https://docs.aws.amaz