Amplitude - Cohort Syncs

This method is used to sync cohorts to Aampe in real-time

Cohorts built in Amplitude can be synced to Aampe in 2 ways

  1. Aampe official destination
  2. [Cohort sync via Webhook] - Syncs to Aampe via a custom webhook

Aampe Official Destination

  1. Go to Menu -> Data


  1. Click on Destinations
  2. Search for Aampe and select Cohorts
  1. Enter the following details
    1. Name: Aampe - Cohorts
    2. API key: {api_key}

      🚧

      API Key

        1. Important Note
          Note that you will need the API key that you can fetch from
        2. Go to: https://compose.aampe.com/system-setup/integrations/events
        3. Login using your org credentials
        4. Select Connect next to Aampe endpoint
        5. Copy the API key
        6. Paste it in place of {api_key}
  2. Select the User ID mapping. Here you want to select user ID which connects to your other aampe data, Aim for a non PII identifier if available.
  1. Hit Save

  2. Go to Users -> Cohorts, Select any Cohort that you want to sync and Hit Target Users and then Sync to Aampe destination


  1. Select Real-time Sync and hit Sync
  1. Your Aampe cohort integration is live

Setup Cohort custom Webhook to Aampe

  1. Go to Menu -> Data
  1. Click on Destinations
  1. Select Add Destination (+) sign
  2. Search for Webhook and Select Webhook (Cohorts) (There will be an event webhook as well - we dont want to select that)
  1. Enter the following settings:
    1. Display Name: Aampe-Cohorts
    2. Webhook URL: https://ingestion.api.aampe.com/v1/amplitude/cohorts
    3. Headers: Add the following Header:
      1. Key: authorization
      2. Value: Bearer {api_key}

        🚧

        Important Note

        Note that you will need the API key that you can fetch from

        1. Go to: https://compose.aampe.com/system-setup/integrations/events
        2. Login using your org credentials
        3. Select Connect next to Aampe endpoint
        4. Copy the API key
        5. Paste it in place of {api_key}
        6. Sample: Bearer my_token
    4. Number of users per batch: 10000
    5. Define cohort update payload:
    6. Select Customize Payload
    7. Copy this to the editor:

    <#assign FtlUtils=statics['com.amplitude.integrations.connector.utils.FtlUtils']>
    {
      "batch": [
        <#list input.users as user>
        {
          "type": "identify",
          "userId": "${user.user_id}",
          
          "traits": {
            "[Amplitude] ${input.cohort_name}: ${input.cohort_id}": ${input.in_cohort}
            <#if user.user_properties?? && user.user_properties?size gt 0>
            ,
            <#list user.user_properties?keys as key>
            "${key}": ${FtlUtils.toJsonString(user.user_properties[key])}<#sep>,</#sep>
            </#list>
            </#if>
          },
          "context": {
            "integration": {
              "name": "Amplitude Cohort Sync",
              "version": "1.0.0"
            }
          }
        }<#sep>,
        </#list>
      ]
    }
    
  1. Hit Save and your destination will be created.
  2. Now to start sycning go to Users -> Cohorts

  1. Select any Cohort that you want to sync and Hit Target Users
  1. Select Sync this to Webhook, and choose Aampe-Cohorts that we previously created
  2. Select Real-time Sync and hit Sync
  1. Your Aampe cohort integration is live