

# Integrate external applications with Amazon Connect Customer Profiles
Integrate external applications

Amazon Connect provides a set of pre-built integrations powered by Amazon AppFlow and Amazon EventBridge. After you enable Amazon Connect Customer Profiles, you can use these integrations to combine information from external applications such as Salesforce or Zendesk, with contact history from Amazon Connect. This creates a customer profile that has all the information agents need during customer interactions in a single place.

You can also use Customer Profiles in Amazon AppFlow. Amazon AppFlow supports `CustomerProfiles` as a destination. You can use Amazon AppFlow APIs to send data into Customer Profiles using `CustomerProfiles` as the destination name.

Before you begin, make sure you are using a customer managed key. For more information about configuring KMS keys, see [Create a KMS key to be used by Customer Profiles to encrypt data (required)](enable-customer-profiles.md#enable-customer-profiles-awsmanagedkey). 

## Set up integrations
Set up integrations

You can setup an integration using either featured applications in Amazon Connect or external applications using Amazon AppFlow by choosing the method that best fits your use-case below. For more detailed information on the integration of ServiceNow and Slack, see the blog post [Combine data from multiple sources using Amazon AppFlow and build a unified Amazon Connect Customer profile for contact center agents](https://aws.amazon.com/blogs/contact-center/unified-customer-data/).

**Topics**
+ [Set up integrations](#setup-integrations-title-menu)
+ [Set up integration for featured applications in Amazon Connect](integrate-customer-profiles-appflow.md)
+ [Set up integration for external applications using Amazon AppFlow](integrate-external-applications-appflow.md)
+ [

# Delete Customer Profiles or stop integrations
](delete-customer-profile-connection.md)

# Set up integration for featured applications in Amazon Connect
Set up integration for featured applications in Amazon Connect

These integrations use Amazon Connect featured applications to provide periodic updates to Amazon Connect Customer Profiles.

## Before you begin
Before you begin

### Bulk ingestion of data
Bulk ingestion of data

When you set up your integration, you are prompted to enter a date how far back you want to go to ingest data. If you choose a date that is more than two months ago, Customer Profiles automatically enables bulk ingestion by creating multiple flows. It does this so you don't have to calculate how many flows you need to ingest data. 

When automatic bulk ingestion is enabled, Customer Profiles does the following:
+ Sets the batch size to two months.
+ Retries on transient failures up to three times before failing.

You can use the [CreateIntegrationWorkflowRequest](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/CreateIntegrationWorkflowRequest .html) API to call your own batch size.

### Why am I asked to select or create an IAM role?
Why am I asked to select or create an IAM role?

For Salesforce, Marketo, and ServiceNow, Customer Profiles helps improve the historical ingestion of these sources by using your IAM role to create several workflows to ingest your data quickly and efficiently. 

 For these sources, if you select more than 60 days back in the **Date for importing records** date picker, you will be prompted to create a new IAM role or select an existing one. This role allows Customer Profiles to manage your integration. It provides Customer Profiles with the necessary permissions to update and create a workflow to ingest your data. After the workflow is complete, Customer Profiles creates a standard, continuous integration that ingests your new data as it is updated in your source. 

The role created in the console is only usable by the domain it was created on. This is because Amazon Connect limits the access of the role to only the KMS key used by the domain. 

For more information, see [Grant least privilege access to your Customer Profiles execution role](#grant-least-privilege-cp).

## Grant least privilege access to your Customer Profiles execution role
Grant least privilege access to your Customer Profiles execution role

If you want to create your own IAM role, we recommend using the permissions shown in the following code to limit the role to the least permissions needed. Use the snippet below to create your role manually. Use your own KMS key and specify your Region where needed. 

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Condition": {
                "ForAnyValue:StringEquals": {
                    "aws:RequestTag/awsOwningService": "customer-profiles-integration-workflow"
                }
            },
            "Action": [
                "appflow:CreateFlow",
                "appflow:TagResource",
                "profile:TagResource",
                "profile:PutIntegration"
            ],
            "Resource": "*",
            "Effect": "Allow",
            "Sid": "CreateFlowResources"
        },
        {
            "Action": [
                "appflow:UseConnectorProfile"
            ],
            "Resource": "*",
            "Effect": "Allow",
            "Sid": "UseConnectorResources"
        },
        {
            "Condition": {
                "ForAnyValue:StringEquals": {
                    "aws:ResourceTag/awsOwningService": "customer-profiles-integration-workflow"
                }
            },
            "Action": [
                "appflow:DescribeFlow",
                "appflow:DescribeFlowExecutionRecords",
                "appflow:DeleteFlow",
                "appflow:StartFlow",
                "appflow:StopFlow",
                "appflow:UpdateFlow",
                "profile:DeleteIntegration"
            ],
            "Resource": "*",
            "Effect": "Allow",
            "Sid": "AccessFlowResources"
        },
        {
            "Action": [
                "kms:CreateGrant",
                "kms:ListGrants"
            ],
            "Resource": [
            "arn:aws:kms:us-east-1:111122223333:key/KeyId"
            ],
            "Condition": {
                "StringEquals": {
                    "kms:ViaService": [
                      "appflow.us-east-1.amazonaws.com"
                    ]
                }
            },
            "Effect": "Allow",
            "Sid": "KMSAppflow"
        },
        {
            "Action": [
                "kms:CreateGrant"
            ],
            "Resource": [
              "arn:aws:kms:us-east-1:111122223333:key/KeyId"
            ],
            "Condition": {
                "StringEquals": {
                    "kms:ViaService": [
                      "profile.us-east-1.amazonaws.com"
                    ]
                },
                "ForAllValues:StringEquals": {
                    "kms:GrantOperations": [
                        "Decrypt"
                    ]
                }
            },
            "Effect": "Allow",
            "Sid": "KMSCustomerProfiles"
        }
    ]
}
```

------

## Monitor your Customer Profiles integrations


After your connection is established, if it stops working, delete the integration and then re-establish it. 

## What to do if objects aren't being sent


If an object fails to be sent, choose **Flow details** to learn more about what's gone wrong. 

You may need to delete the configuration and re-connect to the external application. 

# Set up integration for Amazon Connect Cases
Set up integration for Amazon Connect Cases

To update your Amazon Connect Cases data in Amazon Connect Customer Profiles and use features like calculated attributes, you can integrate using Amazon AppIntegrations. Start by setting up a Cases event stream to send system fields to an EventBridge bus, then use Amazon AppIntegrations to forward these events to Customer Profiles.

## Stream data from Amazon Connect Cases to Event Bridge
Stream data from Cases to Event Bridge

1. Open the Amazon Connect console at [https://console.aws.amazon.com/connect/](https://console.aws.amazon.com/connect/).

1.  On the instances page, choose the instance alias. The instance alias is also your **instance name**, which appears in your Amazon Connect URL. The following image shows the **Amazon Connect virtual contact center instances** page, with a box around the instance alias. 

![\[The instance alias.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/stream-data-from-connect-cases-to-event-bridge-1.png)


1.  In the navigation pane, choose **Cases** and note your Cases domain ID from the **Domain details** section. 

![\[The Cases page, the Domain details section, an arrow pointing to the domain ID.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/stream-data-from-connect-cases-to-event-bridge-2.png)


1.  Using the AWS CLI, create a Case event configuration to send Amazon Connect Cases Events to your AWS account's default Event Bridge bus. 

```
// set up Case Event Configuration including all system fields
aws connectcases put-case-event-configuration --domain-id <YOUR_CASES_DOMAIN_ID> --region <YOUR_AWS_REGION> --event-bridge "{                     
    \"enabled\": true,
    \"includedData\": {
       \"caseData\": {
          \"fields\": [
          {
          \"id\": \"status\"
          },
          {
          \"id\": \"title\"
          },
          {
          \"id\": \"summary\"
          },
          {
          \"id\": \"reference_number\"
          },
          {
          \"id\": \"created_datetime\"
          },
          {
          \"id\": \"last_updated_datetime\"
          },
          {
          \"id\": \"last_closed_datetime\"
          },      
          {
          \"id\": \"customer_id\"
          }
        ]
      }
    }
  }"
```

1.  Open the Event Bridge console for your AWS Region. For example, [https://us-west-2.console.aws.amazon.com/events/home?region=us-west-2\$1/eventbuses](https://us-west-2.console.aws.amazon.com/events/home?region=us-west-2#/eventbuses) 

1.  Choose **Create event bus**.

![\[The Event buses page in the Amazon EventBridge console, the Create event bus button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/stream-data-from-connect-cases-to-event-bridge-3.png)


1.  Create an event bus with name `connect-cases-to-customer-profiles`.

![\[The Create event bus page, the Name box.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/stream-data-from-connect-cases-to-event-bridge-4.png)


1.  Go back to your **default event bus** and create a rule with name `connect-cases-to-customer-profiles-rule`. 

![\[The default event bus, the Create rule button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/stream-data-from-connect-cases-to-event-bridge-5.png)


![\[The Build event pattern step.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/stream-data-from-connect-cases-to-event-bridge-6.png)

+  Event Pattern snippet: 

```
{
  "source": ["aws.cases"],
  "detail": {
    "eventType": ["CASE.UPDATED", "CASE.CREATED", "CASE.DELETED"]
  }
}
```

![\[The Creation method section, the Custom pattern (JSON editor) option, the Event pattern code.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/stream-data-from-connect-cases-to-event-bridge-7.png)

+  Choose **Skip to Review and Create** and then **Create rule**. 

![\[The Skip to Review and create button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/stream-data-from-connect-cases-to-event-bridge-8.png)


## Ingest Event Bridge case data to Customer Profiles by using AppIntegrations
Ingest Event Bridge case data to Customer Profiles by using AppIntegrations

1.  Using the AWS CLI, create an Event Integration with AppIntegrations and record the ARN output.  This represents a source data that a Amazon Connect instance can use. 

```
aws appintegrations create-event-integration --region
    <YOUR_REGION> --name Connect-Cases-Event-Integration
    --event-bridge-bus connect-cases-to-customer-profiles --event-filter
    "{\"Source\": \"aws.cases\" }"
    --description "Event Integration for Cases Event Bus"
```

1.  Using the AWS CLI, create an integration with Customer Profiles using the put-integration API. This will start the flow of data to Customer Profiles, replacing the placeholder values with your Event Integration ARN and Customer Profile domain name. 

```
aws customer-profiles put-integration --region
    <YOUR_REGION> --domain-name <YOUR_CP_DOMAIN_NAME> 
    --uri <YOUR_EVENT_INTEGRATION_ARN> --object-type-name Connect-case
```

## Verify your Cases integration
Verify your Cases integration

1.  Create a case in Amazon Connect Cases.

1.  The event delivery should be almost instantaneous but allow a minute for it to be delivered and associate with the customer profile.

1.  Using the AWS CLI, find the Connect-case object under the profile, replacing the placeholders with the correct values. 

```
aws customer-profiles list-profile-objects --domain-name
    <YOUR_CP_DOMAIN_NAME> --region <YOUR_REGION> 
    --object-type-name Connect-case --profile-id <YOUR_PROFILE_ID>
```

1.  If you don't find an item in the response of the above API call, then there is a problem with your integration. To troubleshoot: 

   1.  Go to the Amazon EventBridge console. 

   1.  Check whether the EventSource is Active and the matching EventBus exists and is running. 

   1.  Check whether your Case Event Configuration is correctly configured. 

   1.  If these are working, contact Support for assistance investigating the issue. 

# Set up Amazon Connect integration with Salesforce, ServiceNow, Marketo, or Zendesk
Set up integration for Salesforce, ServiceNow, Marketo, or Zendesk

To provide periodic updates to Amazon Connect Customer Profiles, you can integrate with Salesforce, ServiceNow, Marketo, or Zendesk using Amazon AppFlow. You first set up the connection in Amazon Connect and the application of your choice, and then verify the integration.

## Set up the connection in Amazon Connect and Salesforce, ServiceNow, Marketo, or Zendesk
Set up the connection in Amazon Connect and Salesforce, ServiceNow, Marketo, or Zendesk

1. Open the Amazon Connect console at [https://console.aws.amazon.com/connect/](https://console.aws.amazon.com/connect/).

1. On the instances page, choose the instance alias. The instance alias is also your **instance name**, which appears in your Amazon Connect URL. The following image shows the **Amazon Connect virtual contact center instances** page, with a box around the instance alias.  
![\[The Amazon Connect virtual contact center instances page, the instance alias.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/instance.png)

1. In the navigation pane, choose **Customer profiles**.

1. On the **Customer profiles configuration** page, choose **Add integration**, as shown in the following image.  
![\[The Customer profiles configuration page, the Add integration button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-addintegration.png)

1. On the **Select data source** page, choose which external application you want to get customer profiles data from. You can view the [integration requirements](https://docs.aws.amazon.com/appflow/latest/userguide/requirements.html) to better understand the connection requirements needed for your application.  
![\[The Select data source page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-cp-salesforce-source.png)

1. On the **Establish connection** page, choose one of the following: 
   + **Use existing connection**: This allows you to reuse existing Amazon AppFlow resources you may have created in your AWS account..
   + **Create new connection**: Enter the information required by the external application.  
![\[The Establish connection page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-establish-connection.png)

1. On the **Integration options** page, choose which source objects you want to ingest and select their object type. 

   Object types store your ingested data. They also define how objects from your integrations are mapped to profiles when they are ingested. Customer Profiles provides default object type templates you can use that define how attributes in your source objects are mapped to the standard objects in Customer Profiles. You can also use the object mappings that you’ve created from the [PutProfileObjectType](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_PutProfileObjectType.html). When adding or creating the Salesforce integration for the user created data mapping, you need to specify the specific data mapping, otherwise it will choose the Salesforce default data mapping for object type. You can create your data mapping and use it when setting up a featured data connector.  
![\[The integration options page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-integration-options.png)

1. For the **Ingestion start date**, Customer Profiles starts ingesting records created after this date. By default, the date for importing records is set at 30 days prior.

1. On the **Review and integrate** page, check that the **Connection status** says **Connected**, and then choose **Create integration**.   
![\[The Review and integrate page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-review-and-integrate.png)

1. After the integration is set up, back on the **Customer profiles configuration** page, choose **View objects** to see what data is being batched and sent. Currently, this process ingests records that were created or modified in the last 30 days.  
![\[The Customer profiles configuration page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-objects.png)

# Set up integration for Segment to provide periodic updates to Amazon Connect Customer Profiles
Set up integration for Segment

To provide periodic updates to Amazon Connect Customer Profiles, you can integrate with Segment using Amazon AppFlow. You first set up the connection in Amazon Connect and Segment, and then verify the Segment integration.

## Set up the connection in Amazon Connect and Segment
Set up the connection in Amazon Connect and Segment

1. Open the Amazon Connect console at [https://console.aws.amazon.com/connect/](https://console.aws.amazon.com/connect/).

1. On the instances page, choose the instance alias. The instance alias is also your **instance name**, which appears in your Amazon Connect URL. The following image shows the **Amazon Connect virtual contact center instances** page, with a box around the instance alias.  
![\[The Amazon Connect virtual contact center instances page, the instance alias.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/instance.png)

1. In the navigation pane, choose **Customer profiles**.

1. On the **Customer profiles configuration** page, choose **Add integration**.  
![\[The Customer profiles configuration page, Add integration button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-addintegration.png)

1. On the **Select data source** page, choose **Segment**. Review the application requirements that are listed on the **Select application** page.  
![\[The Select data source page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-cp-segment-source.png)

1. On the **Establish connection** page, choose one of the following: 
   + **Use existing connection**: This allows you to reuse existing Amazon EventBridge resources that you may have created in your AWS account.
   + **Create new connection**: Enter the information required by the external application.  
![\[The Establish connection page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-segment-establish-connection.png)
     + **Connection name**: Provide a name for your connection. The connection name is referenced by integrations that use this connection.
     + **Connection URL**: Enter your application connection URL. This URL is used for deep-linking into the objects created in your external application. The connection URL is the Segment workspace URL available on the application website. 

       To find your workspace URL:

       1. Log in to your segment.com account.

       1. Go to **Settings**, **General settings**.

       1. Copy the URL from your browser.

1. Customer Profiles uses Amazon EventBridge for integrations with Segment. On the **Source set up** page, copy your AWS account ID to your clipboard, and then choose **Log in to Segment** to configure Amazon EventBridge. 

1. Use the following instructions to set up Segment:

   1. Log in to Segment.

   1. In your application, select a source to set up the destination to Amazon EventBridge.

   1. Paste in your AWS account ID and select your AWS Region.

   1. Toggle **ON**, to activate your partner event source.

1. Go to **Event Tester**, and send a test event to complete activating your partner event source.

1. **Client ID**: This is a string that uniquely distinguishes the client in your external application. This client ID is the Source Name available on the application website. You use the ID that you specify to identify the client that you want Customer Profiles to ingest your objects from. 

   To find your source ID:

   1. Go to **Sources**, and choose a source.

   1. Go to **Settings**, **API Keys**.

   1. Copy your **Source ID**.

   After you set up the event source destination, return to the Customer Profiles console and paste the Client ID.

1. You will see an alert that indicates Amazon Connect has successfully connected with Segment.

1. On the **Integration options** page, choose which source objects you want to ingest and select their object type. 

   Object types store your ingested data. They also define how objects from your integrations are mapped to profiles when they are ingested. Customer Profiles provides default object type templates you can use that define how attributes in your source objects are mapped to the standard objects in Customer Profiles. You can also use the object mappings that you've created from the [PutProfileObjectType](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_PutProfileObjectType.html).   
![\[The Integration options page, the Object type section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-integration-options-segment.png)

1. For the **Ingestion start date**, Customer Profiles starts ingesting records created after the integration is added. 
**Note**  
If you need historical records, you can [use Amazon S3 as an integration source to import them](customer-profiles-object-type-mappings.md). 

1. On the **Review and integrate** page, check that the **Connection status** says **Connected**, and then choose **Add integration**. 

1. After the integration is set up, back on the **Customer profiles configuration** page, the **Integrations** page displays which integrations are currently set up. The **Last run ** and **Integration health** are not currently available for this type of integration.   
![\[The Customer profiles configuration page, the Integrations section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-shopify-integrations-view-card.png)

   To see what data is being sent, choose the integration and\$1 then choose **View objects **.

## Verify your Segment integration


To perform this step you need the following prerequisites: 
+ Access to your Segment workspace.
+ [Access to the Amazon Connect Contact Control Panel](amazon-connect-contact-control-panel.md).

**To verify your Segment integration**

1. Go to your Segment workspace dashboard and choose **Destinations**.  
![\[The segment overview page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-segment-1.png)

1. You will see a list of destinations where that Segment sends data. Choose the EventBridge destination for Customer Profiles.  
![\[The list of destinations page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-segment-2.png)

1. Choose the **Event Tester** tab. From this page you will send a test event to Customer Profiles. The event is ingested and turned into a customer profile that you can view in the Amazon Connect agent application.  
![\[The event tester tab.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-segment-3.png)

1. Select **Identify** as the event type, and select **Event Builder** as your input method.

1. You can specify a **User ID** and some traits. Agents can search for these traits in the agent application. 

1. Choose **Send Event**.

1. The event delivery should be almost instantaneous but allow it a minute for it to be delivered and create a customer profile.

1. Open the Amazon Connect agent application. Search for the user ID you entered in the **Event Builder**. You should be able to see the customer profile with the user ID and the traits you entered.

1. If you cannot see the customer profile, then there is a problem with your integration. To troubleshoot:

   1. Go to the Amazon EventBridge console. 

   1. Check whether the EventSource is Active and the matching EventBus exists and is running.

   If these are working, contact Support for assistance investigating the issue.

## Monitor your Customer Profiles integrations


After your connection is established, if it stops working, delete the integration and then re-establish it. 

## What to do if objects aren't being sent


If an object fails to be sent, choose **Flow details** to learn more about what's gone wrong. 

You may need to delete the configuration and re-connect to the external application. 

# Set up integration for Shopify to provide periodic updates to Amazon Connect Customer Profiles
Set up integration for Shopify

To provide periodic updates to Amazon Connect Customer Profiles, you can integrate with Shopify using Amazon AppIntegrations. You first set up the connection in Amazon Connect and Shopify, and then verify the Shopify integration. 

## Set up the connection in Amazon Connect and Shopify
Set up the connection in Amazon Connect and Shopify

1. Open the Amazon Connect console at [https://console.aws.amazon.com/connect/](https://console.aws.amazon.com/connect/).

1. On the instances page, choose the instance alias. The instance alias is also your **instance name**, which appears in your Amazon Connect URL. The following image shows the **Amazon Connect virtual contact center instances** page, with a box around the instance alias.  
![\[The Amazon Connect virtual contact center instances page, the instance alias.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/instance.png)

1. In the navigation pane, choose **Customer profiles**.

1. On the **Customer profiles configuration** page, choose **Add integration**.  
![\[The Customer profiles configuration page, the Add integration button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-addintegration.png)

1. On the **Select source** page, choose **Shopify**. Review the application requirements that are listed on the **Select application** page.  
![\[The select source page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-cp-shopify-source.png)

1. On the **Establish connection** page, choose one of the following: 
   + **Use existing connection**: This allows you to reuse existing Amazon EventBridge resources that you may have created in your AWS account.
   + **Create new connection**: Enter the information required by the external application.  
![\[The Establish connection page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-shopify-establish-connection.png)
     + **Connection name**: Provide a name for your connection. The connection name is referenced by integrations that use this connection.
     + **Connection URL**: Enter your application connection URL. This URL is used for deep-linking into the objects created in your external application. The connection URL is the Shopify Partner app URL available on the application website. 

       To find your Shopify Partner app URL:
       + Log in to your partners.shopify.com account.
       + Go to your app.
       + Copy the URL from your browser.
     + **Client ID**: Enter your application client ID. This is a string that uniquely distinguishes the client in your external application. This client ID is the Source Name available on the application website. You use the ID that you specify here to identify the client that you want Customer Profiles to ingest your objects from. Your client ID may be available after following the Source setup steps.

       To find your source name:
       + Log in to your partners.shopify.com account.
       + Go to your app.
       + Copy the source name from your Amazon EventBridge event source.

1. On the **Source set up** page, copy your AWS account ID to your clipboard, and then choose **Log in to Shopify**. 

1. Use the following instructions to set up Shopify:

   1. Log in to partners.shopify.com.

   1. Under Amazon EventBridge, choose **Create source**.

   1. Paste in your AWS account ID and select your AWS Region.

   1. After you set up the event source destination, return to Customer Profiles. You will see an alert that indicates Amazon Connect has successfully connected with Shopify.

1. On the **Integration options** page, choose which source objects you want to ingest and select their object type. 

   Object types store your ingested data. They also define how objects from your integrations are mapped to profiles when they are ingested. Customer Profiles provides default object type templates you can use that define how attributes in your source objects are mapped to the standard objects in Customer Profiles. You can also use the object mappings that you've created from the [PutProfileObjectType](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_PutProfileObjectType.html).   
![\[The Integration options page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-integration-options-shopify.png)

1. For the **Ingestion start date**, Customer Profiles starts ingesting records created after the integration is added. 
**Note**  
If you need historical records, you can [use Amazon S3 as an integration source to import them](customer-profiles-object-type-mappings.md). 

1. On the **Review and integrate** page, check that the **Connection status** says **Connected**, and then choose **Add integration**. 
**Note**  
 After adding this integration, you need to [set up webhook subscriptions](#shopify-webhook-subscriptions) to allow events to start flowing into this integration.   
![\[The Review and integrate page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-shopify-webhook.png)

1. After the integration is set up, back on the **Customer profiles configuration** page, the **Integrations** section displays which integrations are currently set up. The **Last run** and **Integration health** are not currently available for this type of integration.   
![\[The Integrations section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-shopify-integrations-view-card.png)

   To see what data is being sent, choose the integration and then choose **View objects**.

1. Go to the next step to use the API to set up **webhook subscriptions** so events can start flowing into this integration.

## Set up webhook subscriptions


1. Use the following URL to make sure your app has the required permissions: 

   ```
   https://{shop}.myshopify.com/admin/oauth/authorize?client_id={api_key}&scope={scopes}&redirect_uri={redirect_uri}&state={nonce}
   ```

   Where:
   + `shop` is the name of your Shopify store.
   + `api_key` is the API Key of your Shopify app. You can find this on the Shopify **App** details page.
   + `scopes` should have the value `read_customers,read_orders,read_draft_orders`.
   + `redirect_uri` is the redirect URI you specified for your app when you created it. For our purposes it can be any valid URL.
   + `nonce` can be any unique value to identify a given authorization request from others. We recommend using a timestamp.

   After you have constructed the URL, paste it into your browser. An installation/authorization page similar to the following image is displayed, asking the store owner to give permissions for the defined scope.  
![\[A shopify page example for installing and authorizing the app.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-enable-shopify-webhook-embedded-app.png)

1. Choose **Install unlisted app** to install and authorize the app on behalf of your store. 

   You will be taken to the redirect URI that you entered with an authorization code appended to redirect URI as a query parameter. For example:

   ```
   https://example.org/some/redirect/uri?code={authorization_code}&hmac=da9d83c171400a41f8db91a950508985&host={base64_encoded_hostname}&timestamp=1409617544&state={nonce}&shop={shop_origin}&host={host}
   ```

1. Copy the `authorization_code` from this URI. You're going to use it to get a permanent access token in the next steps. 

1. Go to whatever tool you use to make API calls. For example, [CURL](https://curl.se/) or [POSTMAN](https://www.postman.com/).

1. To get a permanent access token, make a POST request to the Shopify `Admin` API to this endpoint:

   ```
   https://{shop}.myshopify.com/admin/oauth/access_token
   ```

   with the following request body:

   ```
   {
       "code": "authorization_code_received_from_redirect_uri",
       "client_id": "your_app_api_key",
       "client_secret": "your_app_api_secret"
   }
   ```

   This request returns the following response:

   ```
   {
       "access_token": "permanent_access_token",
       "scope": "read_customers,read_orders,read_draft_orders"
   }
   ```

1. Note the `access_token`. This is a permanent token that has the provided scope from a previous step. Now you are ready to create webhook subscriptions.

1. For the following API calls, make sure you set the HTTP header key `X-Shopify-Access-Token` to the `access_token` you received from the earlier call's response.

1. To setup webhook subscriptions, make the following POST request for each of the `topic` values listed in the next step:

   Endpoint: `https://{shop}.myshopify.com/admin/api/2021-04/webhooks.json`

   Request Body:

   ```
   {
       "webhook": {
           "topic": "replace_this_with_one_of_the_topics_in_the_list_below",
           "address": "this_is_the_event_source_arn_generated_when_you_created_the_event_integration",
           "format": "json"
       }
   }
   ```

1. For each subscription replace the value for `topic` with the following values:
   + `customers/create`
   + `customers/enable`
   + `customers/update`
   + `draft_orders/create`
   + `draft_orders/update`
   + `orders/cancelled`
   + `orders/create`
   + `orders/fulfilled`
   + `orders/paid`
   + `orders/partially_fulfilled`
   + `orders/updated`

You're now all set to receive events from your Shopify store. Next, verify your Shopify integration.

## Verify your Shopify integration


1. Sign in as Admin to your Shopify Store.

1. In the left navigation menu, choose **Customers**.

1. Select **Add Customer**.

1. Enter your customer details. Be sure to enter a phone number and email. These don’t have to belong to a real customer. You will delete this customer entry after verifying the integration. 

1. Save the customer object.

1. The event delivery should be almost instantaneous but allow a minute for it to be delivered and to create a customer profile.

1. Open the Amazon Connect agent experience and look up the user by the email or phone number you entered into the Shopify Store. You should be able to see the customer profile with the same email or phone number.

1. If you cannot see the customer profile, then there is a problem with your integration. To troubleshoot:

   1. Go to the Amazon EventBridge console. 

   1. Check whether the EventSource is Active and the matching EventBus exists and is running.

    If these are working, contact Support for assistance investigating the issue.

## Monitor your Customer Profiles integrations


After your connection is established, if it stops working, delete the integration and then re-establish it. 

## What to do if objects aren't being sent


If an object fails to be sent, choose **Flow details** to learn more about what's gone wrong. 

You may need to delete the configuration and re-connect to the external application. 

# Set up integration for external applications using Amazon AppFlow
Set up integration for external applications using Amazon AppFlow

These integrations use Amazon AppFlow to provide periodic updates to Amazon Connect Customer Profiles. The below steps provide guidance on configuring a connector of your choosing using Amazon AppFlow, configure data mappings, and configure integrations to ingest your customer data.

For more information on Amazon AppFlow pricing, see Amazon AppFlow [pricing](https://aws.amazon.com/appflow/pricing/).

For more information on Amazon AppFlow supported connectors see [Supported source and destination applications](https://docs.aws.amazon.com/appflow/latest/userguide/app-specific.html).

## Before you begin
Before you begin

When you enable Amazon Connect Customer Profiles you create a Customer Profiles domain, which is a container for all data, such as customer profiles, object types, profile keys, and encryption keys. The following are guidelines for creating Customer Profile domains:
+ Each Amazon Connect instance can only be associated with one domain.
+ You can create multiple domains, but they don't share external application integrations or customer data between each other.
+ All the external application integrations you create are at a domain level. All of the Amazon Connect instances associated with a domain inherit the domain's integrations.

**Prerequisite: Enable Customer profiles in your Amazon Connect instance**

1. Open the Amazon Connect console at [https://console.aws.amazon.com/connect/](https://console.aws.amazon.com/connect/).

1. On the instances page, choose the instance alias. The instance alias is also your **instance name**, which appears in your Amazon Connect URL. The following image shows the **Amazon Connect virtual contact center instances** page, with a box around the instance alias.

1. In the navigation pane, choose **Customer profiles**.

1. Choose enable Customer Profiles

In the form, you will be required to complete all the mandatory fields to create a Customer Profiles domain by following the steps below:

1. **Domain Setup**. You can Create New Domain and provide a name.

1. **Encryption**. Under Specify KMS key, you can enable encryption by either selecting an existing AWS KMS key, creating a new AWS KMS key, or you can choose **Select existing domain**.

1. **Error Reporting**. You can provide a Dead letter queue, which is an SQS queue to handle customer profile errors

1. Choose **Submit** and Customer Profiles will be get created using the Contact History information of your instance.

### Set up an external application using Amazon AppFlow
Set up an external application using Amazon AppFlowa

You can add an external application integration to an Amazon Connect Customer Profiles domain by using Amazon AppFlow by following steps below. You must create a flow for your data source in the Amazon AppFlow console and set Amazon Connect Customer Profiles as the destination prior to continuing in the Customer Profiles console. If you created a flow more than 14 days ago, it has expired and you will need to create a new flow for your integration.

You can optionally perform data transformations such as `Arithmetic`, `Filter`, `Map`, `Map_all`, `Mask`, `Merge`, `Truncate`, and `Validate` when using the CloudFormation `AWS::AppFlow::Flow Task` resource prior to ingestion.

1. Log into your AWS Management Console, select Amazon AppFlow, and choose **Create flow**.  
![\[The Amazon AppFlow page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step1.png)

1. Enter the flow name and an optional flow description.  
![\[The Flow details page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step2.png)

1. You can leave the **Data encryption** section as it is since your Amazon Connect Customer Profiles domain already has an existing AWS KMS key that will be used for this Flow. You can optionally create tags and then choose **Next**.  
![\[The data encryption section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step3.png)

1. Select an external application of your choice in the **Source name** dropdown and then select the next relevant field. For example, if you wish to configure Slack, select Slack from the **Source name** dropdown. You can then either select an existing Slack flow or create a new connection.  
![\[The configure flow page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step4.png)

1. If you chose to create a new connection, you can then enter the external application's details such as user name, password and subdomain. You can also select the AWS KMS key for data encryption and enter the connection name to identify this connection.  
![\[The connect to slack page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step5.png)

1. If you choose to use an existing connection you can select the specific external application object from dropdown. For example, If choosing an existing Slack connection, you can select **Conversations** as the object and then choose the specific Slack channel that will be used.  
![\[The source details page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step6.png)

1. In the **Destination details** section, select Amazon Connect as the Destination name in the dropdown and select the Customer profile domain created in the previous prerequisite step.  
![\[The Destination details section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step7.png)

1. Select a flow trigger by choosing **Run on demand** or **Run flow on schedule**. Choose **Next**.
   + **Run on demand** runs the flow only when you trigger it.
   + **Run flow on schedule** runs the flow at a specific time by using a schedule. The schedule frequency is limited to 5 minutes, 15 minutes, or 1 hour.  
![\[The flow trigger section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step8.png)

1. Choose **Manually map fields** under **Mapping method**. Choose the source fields from external application and then choose **Map fields directly**.   
![\[The mapping method section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-create-flow-step9.png)

1. Review and choose **Create flow**.

For more information on creating flows in the Amazon AppFlow console, see [Creating flows in Amazon AppFlow](https://docs.aws.amazon.com/appflow/latest/userguide/create-flow.html).

For more information on the setup of external application and many other supported applications in Amazon AppFlow, see [Supported Amazon AppFlow source and destination applications](https://docs.aws.amazon.com/appflow/latest/userguide/app-specific.html).

### Set up data mappings to define how external application data is mapped to a Customer Profile
Set up data mappings to define how external application data is mapped to a Customer Profile

Once Amazon AppFlow integration has been set up, you need to set up data mappings in Customer Profiles to define how data from the external application will be mapped to the Customer Profile. This will allow you to customize the data that you want to use to build your unified customer profile. Choose your mapping carefully, as you will not be able to choose a different mapping after creating the integration.

For more detailed information on data mappings, see [Object type mapping](https://docs.aws.amazon.com/connect/latest/adminguide/customer-profiles-object-type-mapping.html).

1. Log into your AWS Management Console, select **Amazon Connect**. and choose Customer Profiles under your connect instance alias.  
![\[The Amazon Connect Customer Profiles page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-mapping-step1.png)

1. Choose **Data mappings** and then choose **Create data mapping**. Provide a Data Mapping name and a description.  
![\[The data mapping tab, the create data mapping button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-mapping-step2.png)  
![\[The set data mapping page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-mapping-step2_2.png)

1. Under **Mapping options**, you can choose your **Data source** as the external application, the **Flow name** that you created in the previous section, and the **Data definition method** as *Mapping destination*. Under **Mapping destination** you can choose the types of customer data that wish to define for your unified customer profiles. Choose **Next**.  
![\[The mapping options section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-mapping-step3.png)

1. Add customer, product, case and order attributes with source, destination, and content type, then choose **Next**.  
![\[The map order attributes page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-mapping-step4.png)

1. Under **Specify identifiers**, you can select various attributes from your data source object that helps distinguish your data from other data source objects. You can select attributes from unique, customer, product, case and order identifiers. For more information about identifiers, see [Standard identifiers for setting attributes on the key in Customer Profiles](standard-identifiers.md).   
![\[The Standard identifiers page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-mapping-step5.png)

1. Review and choose **Create Data Mapping**. The Data Mapping status will show as *Active*.  
![\[Identifiers on the Step 6: Specify identifiers page.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-mapping-step6.png)

### Set up integrations to ingest your customer data from an external application
Set up integrations to ingest your customer data from an external application

Once the data mapping set up is done for an external application, you will set up the Data source integration to ingest your customer data. 

1. Log into your AWS Management Console, select **Amazon Connect**. and choose Customer Profiles under your connect instance alias.

1. Under the **Data source integrations** section choose **Add data source integration**.  
![\[Data source integrations tab, add data source integration button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-data-source-integ-step2.png)

1. Under the **Data source** dropdown, select the external application and choose **Next**. You also have the option to choose **Create new flow** which will open the Amazon AppFlow console in a new tab.  
![\[Data source section.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-data-source-integ-step3.png)

1. Under the **Flow name** dropdown, select the flow you want to use from your data source and choose **Next**.  
![\[Selecting a flow name to establish a connection.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-data-source-integ-step4.png)

1. Under the **Data Mapping** dropdown, select the external application data mapping for the object to define how your data source is mapped to profiles. Choose **Next**.  
![\[Select data mapping page, mapping dropdown box.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-data-source-integ-step5.png)

1. Review and choose **Add data Source Integration**. The datasource integration of the external application will initially show as pending before moving to an active state.  
![\[Review and integrate page, add data source integration button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/customer-profiles-ea-data-source-integ-step6.png)

### View the unified customer profile in Amazon Connect Customer Profile Agent CCP
View the unified customer profile in Amazon Connect Customer Profile Agent CCP

Your agents will now be able to view customer data that has been imported from an external application by logging in to the Amazon Connect Agent CCP. For more information on connecting to the Amazon Connect Agent CCP, see [Agent application: Everything in one place](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-contact-control-panel.html#use-agent-application).

Your agent will need to have the appropriate security profile permissions to view Customer Profiles and will be able to perform searches using a key name and value in the profiles search bar.

For more information on security profile permissions, see [Security profiles](https://docs.aws.amazon.com/connect/latest/adminguide/connect-security-profiles.html).

Advanced users who want to build their own custom agent application and embedded customer profiles can use [StreamsJS](https://github.com/amazon-connect/amazon-connect-customer-profiles) which provides more customization over the agent application.

# Delete Customer Profiles or stop integrations


**Note**  
Deleting mappings will only delete objects and data associated with that specific mapping. If there are multiple objects associated with a profile, then deleting a specific mapping may not clear the profile data. If you want to delete specific data, then you would delete the mapping, but your profiles may still exist if they contain data from other mappings. This could result in additional charges for the existing profiles. You can delete a domain and all data from Customer Profiles, including all profiles, by using the [Amazon Connect console](delete-customer-profiles-domain.md) or the [DeleteDomain](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_DeleteDomain.html) API.

**Console method**
+ If at any time you want to stop the ingestion of customer profile data, choose the integration/mapping and then choose **Delete**.
+ To delete the integrations, customer profiles, and all the customer profile data, you can delete your customer profiles domain in the Amazon Connect console. For more information, see [Delete an Amazon Connect Customer Profiles domain](delete-customer-profiles-domain.md).

**API method**
+ To delete customer profiles data for a specific integration, use the `DeleteProfileObjectType` API.
+ To delete the integrations, customer profiles, and all the customer profile data, use the `DeleteDomain` API.

To re-enable the ingestion of customer profile data, go through the setup steps again. 