- 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.
CreateContactCommand
Only the EMAIL channel is supported. The supported initiation methods are: OUTBOUND, AGENT_REPLY, and FLOW.
Creates a new EMAIL contact.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { ConnectClient, CreateContactCommand } from "@aws-sdk/client-connect"; // ES Modules import
// const { ConnectClient, CreateContactCommand } = require("@aws-sdk/client-connect"); // CommonJS import
const client = new ConnectClient(config);
const input = { // CreateContactRequest
InstanceId: "STRING_VALUE", // required
ClientToken: "STRING_VALUE",
RelatedContactId: "STRING_VALUE",
Attributes: { // Attributes
"<keys>": "STRING_VALUE",
},
References: { // ContactReferences
"<keys>": { // Reference
Value: "STRING_VALUE",
Type: "URL" || "ATTACHMENT" || "CONTACT_ANALYSIS" || "NUMBER" || "STRING" || "DATE" || "EMAIL" || "EMAIL_MESSAGE", // required
Status: "AVAILABLE" || "DELETED" || "APPROVED" || "REJECTED" || "PROCESSING" || "FAILED",
Arn: "STRING_VALUE",
StatusReason: "STRING_VALUE",
},
},
Channel: "VOICE" || "CHAT" || "TASK" || "EMAIL", // required
InitiationMethod: "INBOUND" || "OUTBOUND" || "TRANSFER" || "QUEUE_TRANSFER" || "CALLBACK" || "API" || "DISCONNECT" || "MONITOR" || "EXTERNAL_OUTBOUND" || "WEBRTC_API" || "AGENT_REPLY" || "FLOW", // required
ExpiryDurationInMinutes: Number("int"),
UserInfo: { // UserInfo
UserId: "STRING_VALUE",
},
InitiateAs: "CONNECTED_TO_USER",
Name: "STRING_VALUE",
Description: "STRING_VALUE",
SegmentAttributes: { // SegmentAttributes
"<keys>": { // SegmentAttributeValue
ValueString: "STRING_VALUE",
ValueMap: { // SegmentAttributeValueMap
"<keys>": {
ValueString: "STRING_VALUE",
ValueMap: {
"<keys>": "<SegmentAttributeValue>",
},
ValueInteger: Number("int"),
},
},
ValueInteger: Number("int"),
},
},
PreviousContactId: "STRING_VALUE",
};
const command = new CreateContactCommand(input);
const response = await client.send(command);
// { // CreateContactResponse
// ContactId: "STRING_VALUE",
// ContactArn: "STRING_VALUE",
// };
CreateContactCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
Channel Required | Channel | undefined | The channel for the contact CreateContact only supports the EMAIL channel. The following information that states other channels are supported is incorrect. We are working to update this topic. |
InitiationMethod Required | ContactInitiationMethod | undefined | Indicates how the contact was initiated. CreateContact only supports the following initiation methods: OUTBOUND, AGENT_REPLY, and FLOW. The following information that states other initiation methods are supported is incorrect. We are working to update this topic. |
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. |
Attributes | Record<string, string> | undefined | A custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in flows just like any other contact attributes. There can be up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can include only alphanumeric, dash, and underscore characters. |
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 | A description of the contact. |
ExpiryDurationInMinutes | number | undefined | Number of minutes the contact will be active for before expiring |
InitiateAs | InitiateAs | undefined | Initial state of the contact when it's created |
Name | string | undefined | The name of a the contact. |
PreviousContactId | string | undefined | The ID of the previous contact when creating a transfer contact. This value can be provided only for external audio contacts. For more information, see Integrate Amazon Connect Contact Lens with external voice systems in the Amazon Connect Administrator Guide. |
References | Record<string, Reference> | undefined | A formatted URL that is shown to an agent in the Contact Control Panel (CCP). Tasks can have the following reference types at the time of creation: URL | NUMBER | STRING | DATE | EMAIL | ATTACHMENT. |
RelatedContactId | string | undefined | The unique identifier for an Amazon Connect contact. This identifier is related to the contact starting. |
SegmentAttributes | Record<string, SegmentAttributeValue> | undefined | A set of system defined key-value pairs stored on individual contact segments (unique contact ID) using an attribute map. The attributes are standard Amazon Connect attributes. They can be accessed in flows. Attribute keys can include only alphanumeric, -, and _. This field can be used to set Segment Contact Expiry as a duration in minutes. To set contact expiry, a ValueMap must be specified containing the integer number of minutes the contact will be active for before expiring, with |
UserInfo | UserInfo | undefined | User details for the contact |
CreateContactCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
ContactArn | string | undefined | The Amazon Resource Name (ARN) of the created contact. |
ContactId | string | undefined | The identifier of the contact in this instance of Amazon Connect. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You do not have sufficient permissions to perform this action. |
ConflictException | client | Operation cannot be performed at this time as there is a conflict with another operation or contact state. |
IdempotencyException | client | An entity with the same name already exists. |
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. |
ServiceQuotaExceededException | client | The service quota has been exceeded. |
ThrottlingException | client | The throttling limit has been exceeded. |
ConnectServiceException | Base exception class for all service exceptions from Connect service. |