Skip to content

Commit

Permalink
feat(client-connect): Added new API that allows Amazon Connect Outbou…
Browse files Browse the repository at this point in the history
…nd Campaigns to create contacts in Amazon Connect when ingesting your dial requests.
  • Loading branch information
awstools committed Nov 6, 2023
1 parent 05cd167 commit a2827a0
Show file tree
Hide file tree
Showing 21 changed files with 1,573 additions and 625 deletions.
8 changes: 8 additions & 0 deletions clients/client-connect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,14 @@ BatchGetFlowAssociation

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-connect/classes/batchgetflowassociationcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-connect/interfaces/batchgetflowassociationcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-connect/interfaces/batchgetflowassociationcommandoutput.html)

</details>
<details>
<summary>
BatchPutContact
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-connect/classes/batchputcontactcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-connect/interfaces/batchputcontactcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-connect/interfaces/batchputcontactcommandoutput.html)

</details>
<details>
<summary>
Expand Down
20 changes: 20 additions & 0 deletions clients/client-connect/src/Connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ import {
BatchGetFlowAssociationCommandInput,
BatchGetFlowAssociationCommandOutput,
} from "./commands/BatchGetFlowAssociationCommand";
import {
BatchPutContactCommand,
BatchPutContactCommandInput,
BatchPutContactCommandOutput,
} from "./commands/BatchPutContactCommand";
import {
ClaimPhoneNumberCommand,
ClaimPhoneNumberCommandInput,
Expand Down Expand Up @@ -1007,6 +1012,7 @@ const commands = {
AssociateSecurityKeyCommand,
AssociateTrafficDistributionGroupUserCommand,
BatchGetFlowAssociationCommand,
BatchPutContactCommand,
ClaimPhoneNumberCommand,
CreateAgentStatusCommand,
CreateContactFlowCommand,
Expand Down Expand Up @@ -1422,6 +1428,20 @@ export interface Connect {
cb: (err: any, data?: BatchGetFlowAssociationCommandOutput) => void
): void;

/**
* @see {@link BatchPutContactCommand}
*/
batchPutContact(
args: BatchPutContactCommandInput,
options?: __HttpHandlerOptions
): Promise<BatchPutContactCommandOutput>;
batchPutContact(args: BatchPutContactCommandInput, cb: (err: any, data?: BatchPutContactCommandOutput) => void): void;
batchPutContact(
args: BatchPutContactCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: BatchPutContactCommandOutput) => void
): void;

/**
* @see {@link ClaimPhoneNumberCommand}
*/
Expand Down
3 changes: 3 additions & 0 deletions clients/client-connect/src/ConnectClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import {
BatchGetFlowAssociationCommandInput,
BatchGetFlowAssociationCommandOutput,
} from "./commands/BatchGetFlowAssociationCommand";
import { BatchPutContactCommandInput, BatchPutContactCommandOutput } from "./commands/BatchPutContactCommand";
import { ClaimPhoneNumberCommandInput, ClaimPhoneNumberCommandOutput } from "./commands/ClaimPhoneNumberCommand";
import { CreateAgentStatusCommandInput, CreateAgentStatusCommandOutput } from "./commands/CreateAgentStatusCommand";
import { CreateContactFlowCommandInput, CreateContactFlowCommandOutput } from "./commands/CreateContactFlowCommand";
Expand Down Expand Up @@ -666,6 +667,7 @@ export type ServiceInputTypes =
| AssociateSecurityKeyCommandInput
| AssociateTrafficDistributionGroupUserCommandInput
| BatchGetFlowAssociationCommandInput
| BatchPutContactCommandInput
| ClaimPhoneNumberCommandInput
| CreateAgentStatusCommandInput
| CreateContactFlowCommandInput
Expand Down Expand Up @@ -884,6 +886,7 @@ export type ServiceOutputTypes =
| AssociateSecurityKeyCommandOutput
| AssociateTrafficDistributionGroupUserCommandOutput
| BatchGetFlowAssociationCommandOutput
| BatchPutContactCommandOutput
| ClaimPhoneNumberCommandOutput
| CreateAgentStatusCommandOutput
| CreateContactFlowCommandOutput
Expand Down
207 changes: 207 additions & 0 deletions clients/client-connect/src/commands/BatchPutContactCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { Command as $Command } from "@smithy/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
SMITHY_CONTEXT_KEY,
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { BatchPutContactRequest, BatchPutContactResponse } from "../models/models_0";
import { de_BatchPutContactCommand, se_BatchPutContactCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link BatchPutContactCommand}.
*/
export interface BatchPutContactCommandInput extends BatchPutContactRequest {}
/**
* @public
*
* The output of {@link BatchPutContactCommand}.
*/
export interface BatchPutContactCommandOutput extends BatchPutContactResponse, __MetadataBearer {}

/**
* @public
* <note>
* <p>Only the Amazon Connect outbound campaigns service principal is allowed to assume a
* role in your account and call this API.</p>
* </note>
* <p>Allows you to create a batch of contacts in Amazon Connect. The outbound campaigns
* capability ingests dial requests via the <a href="https://docs.aws.amazon.com/connect-outbound/latest/APIReference/API_PutDialRequestBatch.html">PutDialRequestBatch</a>
* API. It then uses BatchPutContact to create contacts corresponding to those
* dial requests. If agents are available, the dial requests are dialed out, which results in a
* voice call. The resulting voice call uses the same contactId that was created by BatchPutContact.
* </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ConnectClient, BatchPutContactCommand } from "@aws-sdk/client-connect"; // ES Modules import
* // const { ConnectClient, BatchPutContactCommand } = require("@aws-sdk/client-connect"); // CommonJS import
* const client = new ConnectClient(config);
* const input = { // BatchPutContactRequest
* ClientToken: "STRING_VALUE",
* InstanceId: "STRING_VALUE", // required
* ContactDataRequestList: [ // ContactDataRequestList // required
* { // ContactDataRequest
* SystemEndpoint: { // Endpoint
* Type: "TELEPHONE_NUMBER" || "VOIP" || "CONTACT_FLOW",
* Address: "STRING_VALUE",
* },
* CustomerEndpoint: {
* Type: "TELEPHONE_NUMBER" || "VOIP" || "CONTACT_FLOW",
* Address: "STRING_VALUE",
* },
* RequestIdentifier: "STRING_VALUE",
* QueueId: "STRING_VALUE",
* Attributes: { // Attributes
* "<keys>": "STRING_VALUE",
* },
* Campaign: { // Campaign
* CampaignId: "STRING_VALUE",
* },
* },
* ],
* };
* const command = new BatchPutContactCommand(input);
* const response = await client.send(command);
* // { // BatchPutContactResponse
* // SuccessfulRequestList: [ // SuccessfulRequestList
* // { // SuccessfulRequest
* // RequestIdentifier: "STRING_VALUE",
* // ContactId: "STRING_VALUE",
* // },
* // ],
* // FailedRequestList: [ // FailedRequestList
* // { // FailedRequest
* // RequestIdentifier: "STRING_VALUE",
* // FailureReasonCode: "INVALID_ATTRIBUTE_KEY" || "INVALID_CUSTOMER_ENDPOINT" || "INVALID_SYSTEM_ENDPOINT" || "INVALID_QUEUE" || "MISSING_CAMPAIGN" || "MISSING_CUSTOMER_ENDPOINT" || "MISSING_QUEUE_ID_AND_SYSTEM_ENDPOINT" || "REQUEST_THROTTLED" || "IDEMPOTENCY_EXCEPTION" || "INTERNAL_ERROR",
* // FailureReasonMessage: "STRING_VALUE",
* // },
* // ],
* // };
*
* ```
*
* @param BatchPutContactCommandInput - {@link BatchPutContactCommandInput}
* @returns {@link BatchPutContactCommandOutput}
* @see {@link BatchPutContactCommandInput} for command's `input` shape.
* @see {@link BatchPutContactCommandOutput} for command's `response` shape.
* @see {@link ConnectClientResolvedConfig | config} for ConnectClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>You do not have sufficient permissions to perform this action.</p>
*
* @throws {@link IdempotencyException} (client fault)
* <p>An entity with the same name already exists.</p>
*
* @throws {@link InternalServiceException} (server fault)
* <p>Request processing failed because of an error or failure with the service.</p>
*
* @throws {@link InvalidRequestException} (client fault)
* <p>The request is not valid.</p>
*
* @throws {@link LimitExceededException} (client fault)
* <p>The allowed limit for the resource has been exceeded.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource was not found.</p>
*
* @throws {@link ConnectServiceException}
* <p>Base exception class for all service exceptions from Connect service.</p>
*
*/
export class BatchPutContactCommand extends $Command<
BatchPutContactCommandInput,
BatchPutContactCommandOutput,
ConnectClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

/**
* @public
*/
constructor(readonly input: BatchPutContactCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: ConnectClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<BatchPutContactCommandInput, BatchPutContactCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, BatchPutContactCommand.getEndpointParameterInstructions())
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "ConnectClient";
const commandName = "BatchPutContactCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
[SMITHY_CONTEXT_KEY]: {
service: "AmazonConnectService",
operation: "BatchPutContact",
},
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

/**
* @internal
*/
private serialize(input: BatchPutContactCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_BatchPutContactCommand(input, context);
}

/**
* @internal
*/
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<BatchPutContactCommandOutput> {
return de_BatchPutContactCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { DescribeTrafficDistributionGroupRequest, DescribeTrafficDistributionGroupResponse } from "../models/models_0";
import { DescribeTrafficDistributionGroupRequest } from "../models/models_0";
import { DescribeTrafficDistributionGroupResponse } from "../models/models_1";
import {
de_DescribeTrafficDistributionGroupCommand,
se_DescribeTrafficDistributionGroupCommand,
Expand Down
2 changes: 1 addition & 1 deletion clients/client-connect/src/commands/DescribeUserCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { DescribeUserRequest, DescribeUserResponse } from "../models/models_0";
import { DescribeUserRequest, DescribeUserResponse } from "../models/models_1";
import { de_DescribeUserCommand, se_DescribeUserCommand } from "../protocols/Aws_restJson1";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { DescribeUserHierarchyGroupRequest } from "../models/models_0";
import { DescribeUserHierarchyGroupResponse } from "../models/models_1";
import { DescribeUserHierarchyGroupRequest, DescribeUserHierarchyGroupResponse } from "../models/models_1";
import { de_DescribeUserHierarchyGroupCommand, se_DescribeUserHierarchyGroupCommand } from "../protocols/Aws_restJson1";

/**
Expand Down
3 changes: 3 additions & 0 deletions clients/client-connect/src/commands/StopContactCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export interface StopContactCommandOutput extends StopContactResponse, __Metadat
* const input = { // StopContactRequest
* ContactId: "STRING_VALUE", // required
* InstanceId: "STRING_VALUE", // required
* DisconnectReason: { // DisconnectReason
* Code: "STRING_VALUE",
* },
* };
* const command = new StopContactCommand(input);
* const response = await client.send(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { UpdateContactFlowModuleMetadataRequest, UpdateContactFlowModuleMetadataResponse } from "../models/models_1";
import { UpdateContactFlowModuleMetadataRequest, UpdateContactFlowModuleMetadataResponse } from "../models/models_2";
import {
de_UpdateContactFlowModuleMetadataCommand,
se_UpdateContactFlowModuleMetadataCommand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { UpdateContactFlowNameRequest, UpdateContactFlowNameResponse } from "../models/models_1";
import { UpdateContactFlowNameRequest, UpdateContactFlowNameResponse } from "../models/models_2";
import { de_UpdateContactFlowNameCommand, se_UpdateContactFlowNameCommand } from "../protocols/Aws_restJson1";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { UpdateContactScheduleRequest, UpdateContactScheduleResponse } from "../models/models_1";
import { UpdateContactScheduleRequest, UpdateContactScheduleResponse } from "../models/models_2";
import { de_UpdateContactScheduleCommand, se_UpdateContactScheduleCommand } from "../protocols/Aws_restJson1";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { UpdateEvaluationFormResponse } from "../models/models_1";
import { UpdateEvaluationFormRequest } from "../models/models_2";
import { UpdateEvaluationFormRequest, UpdateEvaluationFormResponse } from "../models/models_2";
import { de_UpdateEvaluationFormCommand, se_UpdateEvaluationFormCommand } from "../protocols/Aws_restJson1";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { UpdateHoursOfOperationRequest } from "../models/models_1";
import { UpdateHoursOfOperationRequest } from "../models/models_2";
import { de_UpdateHoursOfOperationCommand, se_UpdateHoursOfOperationCommand } from "../protocols/Aws_restJson1";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { UpdateInstanceAttributeRequest } from "../models/models_1";
import { UpdateInstanceAttributeRequest } from "../models/models_2";
import { de_UpdateInstanceAttributeCommand, se_UpdateInstanceAttributeCommand } from "../protocols/Aws_restJson1";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@smithy/types";

import { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { UpdateInstanceStorageConfigRequest } from "../models/models_1";
import { UpdateInstanceStorageConfigRequest } from "../models/models_2";
import {
de_UpdateInstanceStorageConfigCommand,
se_UpdateInstanceStorageConfigCommand,
Expand Down
1 change: 1 addition & 0 deletions clients/client-connect/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from "./AssociateRoutingProfileQueuesCommand";
export * from "./AssociateSecurityKeyCommand";
export * from "./AssociateTrafficDistributionGroupUserCommand";
export * from "./BatchGetFlowAssociationCommand";
export * from "./BatchPutContactCommand";
export * from "./ClaimPhoneNumberCommand";
export * from "./CreateAgentStatusCommand";
export * from "./CreateContactFlowCommand";
Expand Down
Loading

0 comments on commit a2827a0

Please sign in to comment.