AWS.CustomerProfiles reference
BatchGetIntentForProfile
Section titled “BatchGetIntentForProfile”Source:
packages/aws/src/CustomerProfiles/BatchGetIntentForProfile.ts
Runtime binding for profile:BatchGetIntentForProfile: get the Predictive
Intent results for one profile in the bound Domain.
The profile is found by a search key (KeyName and KeyValues) that must
match exactly one profile: no match fails with ResourceNotFoundException,
more than one with BadRequestException. The call succeeds partially. An
intent that can’t be generated, because its type isn’t enabled in the
domain’s IntentDefinition or the profile has too little recent activity,
is returned in Errors with a Code, not as a failure.
Provide AWS.CustomerProfiles.BatchGetIntentForProfileHttp on the hosting
Lambda Function to satisfy the requirement.
BatchGetIntentForProfile: Reading a Profile’s Intents
Section titled “BatchGetIntentForProfile: Reading a Profile’s Intents”Get Two Intents for a Profile
// init: grants profile:BatchGetIntentForProfile on the domain's intentsconst getIntents = yield* AWS.CustomerProfiles.BatchGetIntentForProfile(domain);
// runtimeconst { Intents, Errors } = yield* getIntents({ IntentDomain: "DEFAULT", Intents: ["PRICE_SENSITIVITY", "LAST_SEARCH_INTENT"], KeyName: "_profileId", KeyValues: [profileId],});Tell Missing Data from a Disabled Intent
const { Errors } = yield* getIntents({ IntentDomain: "DEFAULT", Intents: ["PRICE_SENSITIVITY"], KeyName: "_profileId", KeyValues: [profileId],});for (const error of Errors) { // "INSUFFICIENT_DATA" | "INTENT_NOT_ENABLED" | "INTERNAL_SERVER_ERROR" yield* Effect.log(`${error.IntentType}: ${error.Code}`);}Domain
Section titled “Domain”Source:
packages/aws/src/CustomerProfiles/Domain.ts
An Amazon Connect Customer Profiles domain: the container for customer profiles, their object types, keys, and the intent definitions that turn on Predictive Intent.
Domain: Creating Domains
Section titled “Domain: Creating Domains”Basic Domain
const domain = yield* AWS.CustomerProfiles.Domain("Customers");Keep Profiles for 30 Days
const domain = yield* AWS.CustomerProfiles.Domain("Customers", { defaultExpirationDays: 30, tags: { team: "growth" },});Encrypt with Your Own Key
const key = yield* AWS.KMS.Key("CustomersKey");
const domain = yield* AWS.CustomerProfiles.Domain("Customers", { defaultEncryptionKey: key.keyArn,});Domain: Predictive Intent
Section titled “Domain: Predictive Intent”yield* AWS.CustomerProfiles.IntentDefinition("Intents", { domainName: domain.domainName, intents: [{ PriceSensitivityConfig: { Enabled: true } }],});Domain: Looking up an existing domain
Section titled “Domain: Looking up an existing domain”Domain.lookup references a domain Alchemy doesn’t manage (created in the
console or by another stack), found by domainName. It is read during
plan/deploy and never created, updated or deleted.
const existing = AWS.CustomerProfiles.Domain.lookup({ domainName: "customers" });IntentDefinition
Section titled “IntentDefinition”Source:
packages/aws/src/CustomerProfiles/IntentDefinition.ts
The intent definition of a Customer Profiles domain: which Predictive Intent types are enabled. Predictive Intent reads a profile’s recent web clickstream activity and generates the enabled intents for it, such as how price-driven the customer is or what they last searched for.
IntentDefinition: Enabling Intents
Section titled “IntentDefinition: Enabling Intents”Enable Price Sensitivity
const domain = yield* AWS.CustomerProfiles.Domain("Customers");
const intents = yield* AWS.CustomerProfiles.IntentDefinition("Intents", { domainName: domain.domainName, intents: [{ PriceSensitivityConfig: { Enabled: true } }],});Enable Several Intent Types
yield* AWS.CustomerProfiles.IntentDefinition("Intents", { domainName: domain.domainName, intents: [ { PriceSensitivityConfig: { Enabled: true } }, { WebSessionSummaryConfig: { Enabled: true } }, { UpgradeUpsellPropensityConfig: { Enabled: true } }, { LastSearchIntentConfig: { Enabled: true } }, ], tags: { team: "growth" },});Turn One Type Off and Keep It Listed
yield* AWS.CustomerProfiles.IntentDefinition("Intents", { domainName: domain.domainName, intents: [ { PriceSensitivityConfig: { Enabled: true } }, { LastSearchIntentConfig: { Enabled: false } }, ],});IntentDefinition: Reading Intents at Runtime
Section titled “IntentDefinition: Reading Intents at Runtime”// init: grants profile:BatchGetIntentForProfile on the domain's intentsconst getIntents = yield* AWS.CustomerProfiles.BatchGetIntentForProfile(domain);
// runtimeconst { Intents, Errors } = yield* getIntents({ IntentDomain: "DEFAULT", Intents: ["PRICE_SENSITIVITY"], KeyName: "_profileId", KeyValues: [profileId],});ListIntentTypes
Section titled “ListIntentTypes”Source:
packages/aws/src/CustomerProfiles/ListIntentTypes.ts
Runtime binding for profile:ListIntentTypes: list the Predictive Intent
types that an IntentDefinition can enable, grouped by intent domain, each
with a description. The list belongs to the service, not to a Customer
Profiles domain, so the binding takes no resource.
Provide AWS.CustomerProfiles.ListIntentTypesHttp on the hosting Lambda
Function to satisfy the requirement.
ListIntentTypes: Listing Intent Types
Section titled “ListIntentTypes: Listing Intent Types”List Every Intent Type
// init: grants profile:ListIntentTypesconst listIntentTypes = yield* AWS.CustomerProfiles.ListIntentTypes();
// runtimeconst { Items } = yield* listIntentTypes();for (const group of Items) { for (const type of group.Types) { yield* Effect.log(`${group.IntentDomain}/${type.IntentType}: ${type.Description}`); }}List the Types of One Intent Domain
const { Items } = yield* listIntentTypes({ IntentDomain: "DEFAULT" });