Associations

Associations allows you to pull in several different resources from an integration provider all at once, while also keeping track of how they are connected or related to each other. For example, let's say you want to pull in contact data from CRMs. For every contact, you want to also pull in their associated company data.

To do so, simply specify associations: true for the specific endgrate_type you want associated data for. In this example, the payload to our request to the POST api/session/initiate endpoint would look something like this:

{
  "schema": [
    {
      "endgrate_type": "crm-contact",
      "associations": true
    },
    {
      "endgrate_type": "crm-company"
    }
  ]
}

Here, we specify associations: true for the crm-contact endgrate_type since we want the associated company data for it.

When pulling in data either through the data webhook or calling the API, endgrate-types that have associations will return them in the associations array. In the example below, we see the data returned for crm-contact:

"transfer_data": [
  {
    // an ID that identifies this contact, returned by the integration provider
    "id": "provider_resource_id",
    // standard contact data
    "data": {...},
    // associated IDs keyed by `endgrate_type`, if `associations: true`
    "associations": {
      // associated company IDs for this contact
      "crm-company": ["provider_resource_id", "provider_resource_id", "provider_resource_id"]
    }
  }
]