Mixpanel Integration via REST API

This article describes how to get your Mixpanel "People" information into your target data warehouse via a REST API input. Typically this is used to augment your existing Mixpanel integration.

The process is slightly different from other REST API integrations in Alooma:

  1. Use Alooma's API to create an input.

  2. Use Alooma's UI to edit the new input.

Creating the Input

To create the input, make any necessary changes to the values set at the top of the following script and then run it.

import alooma
import requests
from requests.auth import HTTPBasicAuth

# Set These Values
alooma_api_key = "<...>"      # get this from the Alooma UI
input_label = "<name>"        # you specify, cannot change later
mixpanel_api_key = '<...>'    # get this from Mixpanel's site
mixpanel_api_secret = '<...>' # get this from Mixpanel's site
destination_schema = "<public>"

# Code Below Does Not Need to be Edited
api = alooma.Client(api_key=alooma_api_key)
url = ""

params = {}
headers = {}
auth = HTTPBasicAuth(mixpanel_api_secret, mixpanel_api_key)

request_type = "GET" # or POST

res = requests.request(request_type, url, params=params, headers=headers, auth=auth)
data = res.json()

config = {
    'base_url': '',
    'data_field': 'results',
    'frequency': 1440, # In Minutes
    'headers': [],
    'initial_value': 1,
    'input_default_schema': destination_schema,
    'page_parameter': 'page',
    'pagination_type': 'Incremental',
    'parameters': [{'parameter': 'session_id', 'type': 'Text', 'value': data["session_id"]},
                   {'parameter': u'where', 'template': 'properties["$last_seen"]>="%Y-%m-%dT00:00:00"',
                    'type': 'Days Past', 'value': 3650}],
    'primary_keys': [],
    'request': 'GET',
    "username": mixpanel_api_secret, "password": mixpanel_api_key

new_input = {
    "name": input_label,
    "type": "REST_INPUT",
    "configuration": config


After you run the code above, a new input is created. You should get an initial import of the historical data. 

Important: You should now edit the input and set the number of days of data you want to import each time the input updates.

Editing the Input

Now that you have created the input, you'll need to edit the number of days of data it imports each time.

  1. On the Plumbing page, click on your new input.

  2. Change the number of days to a lower number, probably something between 7 and 30, for example.

  3. Save your changes.

Search results

    No results found