StopContactCommand

Ends the specified contact. Use this API to stop queued callbacks. It does not work for voice contacts that use the following initiation methods:

  • DISCONNECT

  • TRANSFER

  • QUEUE_TRANSFER

  • EXTERNAL_OUTBOUND

  • MONITOR

Chat and task contacts can be terminated in any state, regardless of initiation method.

Example Syntax

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

import { ConnectClient, StopContactCommand } from "@aws-sdk/client-connect"; // ES Modules import
// const { ConnectClient, StopContactCommand } = require("@aws-sdk/client-connect"); // CommonJS import
const client = new ConnectClient(config);
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);
// {};

StopContactCommand Input

See StopContactCommandInput for more details

Parameter
Type
Description
ContactId
Required
string | undefined

The ID of the contact.

InstanceId
Required
string | undefined

The identifier of the Amazon Connect instance. You can find the instance ID  in the Amazon Resource Name (ARN) of the instance.

DisconnectReason
DisconnectReason | undefined

The reason a contact can be disconnected. Only Amazon Connect outbound campaigns can provide this field.

StopContactCommand Output

See StopContactCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
ContactNotFoundException
client

The contact with the specified ID is not active or does not exist. Applies to Voice calls only, not to Chat or Task contacts.

InternalServiceException
server

Request processing failed because of an error or failure with the service.

InvalidParameterException
client

One or more of the specified parameters are not valid.

InvalidRequestException
client

The request is not valid.

ResourceNotFoundException
client

The specified resource was not found.

ConnectServiceException
Base exception class for all service exceptions from Connect service.