Importing customers

Important: This feature is available upon request. Ask your Medallia expert to file a Feature activation request with Medallia Support.

Use Query API to import your customer database directly into Medallia Experience Cloud.

To create or update contacts with Query API, use the updateCustomers mutation to impact the customers node, like this:

Update customers mutation

mutation updateCustomers($customers: [ContactUpdate!]!) {
  updateCustomers(customers: $customers)
}

Contact data should be encoded in a JSON array of objects, with each object containing keys and values that match the customer schema keys in your instance and their corresponding values.

Sample mutations: variables

{
    "customers": [
      {
        "values": [
          {"key": "external_customer_id", "value": "555555555"},
          {"key": "first_name", "value": "Mike"},
          {"key": "last_name", "value": "Weaver"}
        ]
      }
    ]
}

Sample response

Finished importing a batch of 1 updates in 111 ms. 1 new contacts, 0 updated contacts. Ignored fields: []

Designing the payload variables

Keys sent in the payload must correspond to your specific instance customerSchema attribute keys, if you send an unmapped key in the payload, it is ignored.

Query API allows you to create and update contacts as long as the payload contains data for at least one unique identifier flagged as such in your customer schema. For every attribute in the schema, there is an isKey field that tracks whether the attribute is a unique identifier.

Use the following query to inspect the customerSchema node to see which attributes are available, their key value, and which attributes are unique identifiers.

Example - Inspect the customer schema

query contactMetadata {
  customerSchema {
    attributes(
      first: 3
    	){
      nodes {
        key
        name
        containsPii
        type
        isKey
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  }
}

Sample response

{
  "data": {
    "customerSchema": {
      "attributes": {
        "nodes": [
          {
            "key": "external_customer_id",
            "name": "External Customer ID",
            "containsPii": true,
            "type": "STRING",
            "isKey": true
          },
          {
            "key": "first_name",
            "name": "First name",
            "containsPii": true,
            "type": "STRING",
            "isKey": false
          },
          {
            "key": "last_name",
            "name": "Last name",
            "containsPii": true,
            "type": "STRING",
            "isKey": false
          }
        ],
        "pageInfo": {
          "hasNextPage": true,
          "endCursor": "MzA="
        }
      }
    }
  },
  "errors": null,
  "_links": null,
  "_allowed": [
    "POST",
    "GET"
  ]
}

Use the attributes to build your payload:

{
    "customers": [
      {
        "values": [
          {"key": "external_customer_id", "value": "9356100019416236"},
          {"key": "first_name", "value": "Brian"},
          {"key": "last_name", "value": "Mayo"}
        ]
      }
    ]
}

These attributes in turn correspond to Medallia fields, specifically to contact fields. Contact fields store information related to the individuals who are asked for (and give) feedback. Examples of contact fields include Name, Email, Customer ID, or any other field that includes demographic information.

Important: When you send an empty string ("") as the value for one of the keys, the field it is mapped to in Medallia Experience Cloud is deleted.
Important: When there is an alternative set defined for a field in Experience Cloud, this operation will only accept the values defined for that alternative set as valid values for the corresponding key. If you send a different value, you will receive an error message.

Contact fields are distinct from other types of Program fields, but they are matched using program and schema mappings.

Once the mapping is complete, use Query API to push contact data into Medallia Experience Cloud, and enrich survey fields with the imported data.

For Contact fields to display data in customer profiles, they must be mapped to fields in the Event and Feedback fields table.