Skip to content

How to Retrieve and Update a Specific Attribute in Amazon Connect Customer Profiles from Lambda?

0

I need to update a customer profile from a Lambda function when a call comes in. Specifically, I want to append the call summary along with the date of the call to an existing summary already stored in the customer profile (if present).

To do this, I need to first retrieve the current profile data, then update the Call Summary attribute. However, I noticed that there is no get-profile CLI command or equivalent API in the AWS SDK.

How can I retrieve a customer profile or the existing attributes, so I can safely update just one field (Call Summary) without overwriting other attributes?

Is there a recommended approach for this in Amazon Connect’s Customer Profiles, especially for use within a Lambda function?

2 Answers
0

To retrieve and update a specific attribute in Amazon Connect Customer Profiles from a Lambda function, you can follow these steps:

  1. First, use the "GetProfile" API to retrieve the existing customer profile. Although there isn't a direct get-profile CLI command, you can use the AWS SDK in your Lambda function to call this API.

  2. Once you have the profile data, you can extract the existing Call Summary attribute (if present).

  3. Append the new call summary along with the date to the existing summary.

  4. Use the "UpdateProfile" API to update only the Call Summary attribute in the customer profile.

Here's a general approach you can use in your Lambda function:

  1. Use the AWS SDK for your preferred language (e.g., Python, Node.js) in your Lambda function.

  2. Call the GetProfile API, providing the necessary identifiers (e.g., ProfileId, DomainName) to retrieve the existing profile.

  3. Extract the current Call Summary from the retrieved profile data.

  4. Append the new call summary and date to the existing summary.

  5. Use the UpdateProfile API to update only the Call Summary attribute. You'll need to provide the ProfileId, DomainName, and the updated Call Summary in the Attributes field.

This approach allows you to safely update just the Call Summary field without overwriting other attributes in the customer profile. It's important to note that you should handle cases where the profile might not exist or the Call Summary attribute is not present.

Remember to grant your Lambda function the necessary permissions to access the Customer Profiles APIs. You'll need to update the Lambda execution role to include permissions for actions like customerprofiles:GetProfile and customerprofiles:UpdateProfile.

By following this method, you can efficiently retrieve and update a specific attribute in Amazon Connect Customer Profiles from your Lambda function when a call comes in, ensuring that you're only modifying the intended data while preserving other profile information.
Sources
UpdateProfile - Amazon Connect Customer Profiles
Flow block in Amazon Connect: Customer profiles - Amazon Connect
UpdateCustomerProfile - Amazon Connect

answered 7 months ago
  • But is there an GetProfile API ?

0

Amazon Connect will already provide some input to the Lambda. Have a look at the following example & how to configure it: https://docs.aws.amazon.com/connect/latest/adminguide/connect-lambda-functions.html#tutorial-invokelambda

If you want to query additional information through the Lambda, I recommend using one of the SDKs. For Python "batch_get_profile" would be an option: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/customer-profiles/client/batch_get_profile.html

AWS
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.