- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
SearchContactsCommand
Searches contacts in an Amazon Connect instance.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { ConnectClient, SearchContactsCommand } from "@aws-sdk/client-connect"; // ES Modules import
// const { ConnectClient, SearchContactsCommand } = require("@aws-sdk/client-connect"); // CommonJS import
const client = new ConnectClient(config);
const input = { // SearchContactsRequest
InstanceId: "STRING_VALUE", // required
TimeRange: { // SearchContactsTimeRange
Type: "INITIATION_TIMESTAMP" || "SCHEDULED_TIMESTAMP" || "CONNECTED_TO_AGENT_TIMESTAMP" || "DISCONNECT_TIMESTAMP", // required
StartTime: new Date("TIMESTAMP"), // required
EndTime: new Date("TIMESTAMP"), // required
},
SearchCriteria: { // SearchCriteria
AgentIds: [ // AgentResourceIdList
"STRING_VALUE",
],
AgentHierarchyGroups: { // AgentHierarchyGroups
L1Ids: [ // HierarchyGroupIdList
"STRING_VALUE",
],
L2Ids: [
"STRING_VALUE",
],
L3Ids: [
"STRING_VALUE",
],
L4Ids: [
"STRING_VALUE",
],
L5Ids: [
"STRING_VALUE",
],
},
Channels: [ // ChannelList
"VOICE" || "CHAT" || "TASK" || "EMAIL",
],
ContactAnalysis: { // ContactAnalysis
Transcript: { // Transcript
Criteria: [ // TranscriptCriteriaList // required
{ // TranscriptCriteria
ParticipantRole: "AGENT" || "CUSTOMER" || "SYSTEM" || "CUSTOM_BOT" || "SUPERVISOR", // required
SearchText: [ // SearchTextList // required
"STRING_VALUE",
],
MatchType: "MATCH_ALL" || "MATCH_ANY", // required
},
],
MatchType: "MATCH_ALL" || "MATCH_ANY",
},
},
InitiationMethods: [ // InitiationMethodList
"INBOUND" || "OUTBOUND" || "TRANSFER" || "QUEUE_TRANSFER" || "CALLBACK" || "API" || "DISCONNECT" || "MONITOR" || "EXTERNAL_OUTBOUND" || "WEBRTC_API" || "AGENT_REPLY" || "FLOW",
],
QueueIds: [ // QueueIdList
"STRING_VALUE",
],
SearchableContactAttributes: { // SearchableContactAttributes
Criteria: [ // SearchableContactAttributesCriteriaList // required
{ // SearchableContactAttributesCriteria
Key: "STRING_VALUE", // required
Values: [ // SearchableContactAttributeValueList // required
"STRING_VALUE",
],
},
],
MatchType: "MATCH_ALL" || "MATCH_ANY",
},
SearchableSegmentAttributes: { // SearchableSegmentAttributes
Criteria: [ // SearchableSegmentAttributesCriteriaList // required
{ // SearchableSegmentAttributesCriteria
Key: "STRING_VALUE", // required
Values: [ // SearchableSegmentAttributeValueList // required
"STRING_VALUE",
],
},
],
MatchType: "MATCH_ALL" || "MATCH_ANY",
},
},
MaxResults: Number("int"),
NextToken: "STRING_VALUE",
Sort: { // Sort
FieldName: "INITIATION_TIMESTAMP" || "SCHEDULED_TIMESTAMP" || "CONNECTED_TO_AGENT_TIMESTAMP" || "DISCONNECT_TIMESTAMP" || "INITIATION_METHOD" || "CHANNEL", // required
Order: "ASCENDING" || "DESCENDING", // required
},
};
const command = new SearchContactsCommand(input);
const response = await client.send(command);
// { // SearchContactsResponse
// Contacts: [ // Contacts // required
// { // ContactSearchSummary
// Arn: "STRING_VALUE",
// Id: "STRING_VALUE",
// InitialContactId: "STRING_VALUE",
// PreviousContactId: "STRING_VALUE",
// InitiationMethod: "INBOUND" || "OUTBOUND" || "TRANSFER" || "QUEUE_TRANSFER" || "CALLBACK" || "API" || "DISCONNECT" || "MONITOR" || "EXTERNAL_OUTBOUND" || "WEBRTC_API" || "AGENT_REPLY" || "FLOW",
// Channel: "VOICE" || "CHAT" || "TASK" || "EMAIL",
// QueueInfo: { // ContactSearchSummaryQueueInfo
// Id: "STRING_VALUE",
// EnqueueTimestamp: new Date("TIMESTAMP"),
// },
// AgentInfo: { // ContactSearchSummaryAgentInfo
// Id: "STRING_VALUE",
// ConnectedToAgentTimestamp: new Date("TIMESTAMP"),
// },
// InitiationTimestamp: new Date("TIMESTAMP"),
// DisconnectTimestamp: new Date("TIMESTAMP"),
// ScheduledTimestamp: new Date("TIMESTAMP"),
// SegmentAttributes: { // ContactSearchSummarySegmentAttributes
// "<keys>": { // ContactSearchSummarySegmentAttributeValue
// ValueString: "STRING_VALUE",
// },
// },
// },
// ],
// NextToken: "STRING_VALUE",
// TotalCount: Number("long"),
// };
SearchContactsCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
InstanceId Required | string | undefined | The identifier of Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance. |
TimeRange Required | SearchContactsTimeRange | undefined | Time range that you want to search results. |
MaxResults | number | undefined | The maximum number of results to return per page. |
NextToken | string | undefined | The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results. |
SearchCriteria | SearchCriteria | undefined | The search criteria to be used to return contacts. |
Sort | Sort | undefined | Specifies a field to sort by and a sort order. |
SearchContactsCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Contacts Required | ContactSearchSummary[] | undefined | Information about the contacts. |
NextToken | string | undefined | If there are additional results, this is the token for the next set of results. |
TotalCount | number | undefined | The total number of contacts which matched your search query. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
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. |
ThrottlingException | client | The throttling limit has been exceeded. |
ConnectServiceException | Base exception class for all service exceptions from Connect service. |