← Airtable + Mixpanel integrations

mixpanel.track with Mixpanel API on New Records from Airtable API

Pipedream makes it easy to connect APIs for Mixpanel, Airtable and 1000+ other apps remarkably fast.

Trigger workflow on
New Records from the Airtable API
Next, do this
mixpanel.track with the Mixpanel API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜

Trusted by 500,000+ developers from startups to Fortune 500 companies

Adyen logo
Brex logo
Carta logo
Checkr logo
Chameleon logo
DevRev logo
LinkedIn logo
Netflix logo
New Relic logo
OnDeck logo
Replicated logo
Scale AI logo
Teamwork logo
Warner Bros. logo
Xendit logo

Developers Pipedream

Getting Started

This integration creates a workflow with a Airtable trigger and Mixpanel action. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Select this integration
  2. Configure the New Records trigger
    1. Connect your Airtable account
    2. Configure timer
    3. Select a Base
    4. Select a Table
  3. Configure the mixpanel.track action
    1. Connect your Mixpanel account
    2. Configure event_name
    3. Configure distinct_id
    4. Configure properties
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, source-available components from Pipedream's GitHub repo. These components are developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Trigger

Description:Emit an event for each new record in a table
Version:0.2.0
Key:airtable-new-records

Airtable Overview

Using the Airtable API, you can build applications that can:

  • Create and manage databases
  • Add, update, and delete records
  • Search for records
  • Sort and filter records
  • Display records in a variety of ways
  • Import and export data

Trigger Code

import moment from "moment";
import { axios } from "@pipedream/platform";

import common from "../common.mjs";

export default {
  ...common,
  name: "New Records",
  description: "Emit an event for each new record in a table",
  key: "airtable-new-records",
  version: "0.2.0",
  type: "source",
  props: {
    ...common.props,
    tableId: {
      propDefinition: [
        common.props.airtable,
        "tableId",
        ({ baseId }) => ({
          baseId,
        }),
      ],
    },
  },
  async run() {
    const {
      baseId,
      tableId,
      viewId,
    } = this;

    const config = {
      url: `https://api.airtable.com/v0/${encodeURIComponent(baseId)}/${encodeURIComponent(tableId)}`,
      params: {},
      headers: {
        Authorization: `Bearer ${this.airtable.$auth.api_key}`,
      },
    };

    const lastTimestamp = this.db.get("lastTimestamp");
    config.params.filterByFormula = `CREATED_TIME() > "${lastTimestamp}"`;

    const data = await axios(this, config);

    if (!data.records.length) {
      console.log("No new records.");
      return;
    }

    const metadata = {
      baseId,
      tableId,
      viewId,
    };

    let maxTimestamp;
    let recordCount = 0;
    for (const record of data.records) {
      record.metadata = metadata;

      this.$emit(record, {
        ts: moment(record.createdTime).valueOf(),
        summary: JSON.stringify(record.fields),
        id: record.id,
      });
      if (!maxTimestamp || moment(record.createdTime).valueOf() > moment(maxTimestamp).valueOf()) {
        maxTimestamp = record.createdTime;
      }
      recordCount++;
    }
    console.log(`Emitted ${recordCount} new records(s).`);
    this.db.set("lastTimestamp", maxTimestamp);
  },
};

Trigger Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
AirtableairtableappThis component uses the Airtable app.
N/Adb$.service.dbThis component uses $.service.db to maintain state between executions.
timer$.interface.timer
BasebaseIdstringSelect a value from the drop down menu.
TabletableIdstringSelect a value from the drop down menu.

Trigger Authentication

Airtable uses API keys for authentication. When you connect your Airtable account, Pipedream securely stores the keys so you can easily authenticate to Airtable APIs in both code and no-code steps.

Visit your account settings, copy your API key, and enter it below. If you only need to read data from Airtable, and not modify it, you can generate a read-only API key.


get airtable api key

About Airtable

Looks like a spreadsheet, acts like a database.

Action

Description:Send an event to mixpanel
Version:0.3.1
Key:mixpanel-emit-event-to

Mixpanel Overview

Mixpanel is a powerful analytics API that allows you to track, analyze, and
engage with your users. With Mixpanel, you can build a variety of applications
and services, including:

  • A user analytics platform, for tracking user behavior and engagement
  • A marketing platform, for segmenting users and delivering targeted messages
  • A customer support platform, for tracking customer issues and resolving them
    efficiently
  • A product management platform, for tracking product usage and understanding
    how users interact with your product

Action Code

// legacy_hash_id: a_Nqir27
import Mixpanel from "mixpanel";

export default {
  key: "mixpanel-emit-event-to",
  name: "mixpanel.track",
  description: "Send an event to mixpanel",
  version: "0.3.1",
  type: "action",
  props: {
    mixpanel: {
      type: "app",
      app: "mixpanel",
    },
    event_name: {
      type: "string",
      description: "The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.",
    },
    distinct_id: {
      type: "string",
    },
    properties: {
      type: "object",
      description: "A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.",
    },
  },
  async run() {
    const mixpanel = await Mixpanel.init(this.mixpanel.$auth.token, {
      protocol: "https",
    });

    // We purposely separated distinct_id to make it explicit; however, we include it in the return value
    await new Promise((resolve) => mixpanel.track(
      this.event_name,
      Object.assign({
        "distinct_id": this.distinct_id,
      }, this.properties),
      resolve,
    ));

    return Object.assign({
      "distinct_id": this.distinct_id,
    }, this.properties);
  },
};

Action Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI.

LabelPropTypeDescription
MixpanelmixpanelappThis component uses the Mixpanel app.
event_nameevent_namestring

The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.

distinct_iddistinct_idstring
propertiespropertiesobject

A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.

Action Authentication

Mixpanel uses API keys for authentication. When you connect your Mixpanel account, Pipedream securely stores the keys so you can easily authenticate to Mixpanel APIs in both code and no-code steps.

Enter your project token below.

About Mixpanel

Powerful, self-serve product analytics to help you convert, engage, and retain more users

More Ways to Connect Mixpanel + Airtable

mixpanel.track with Mixpanel API on New, Modified or Deleted Records from Airtable API
Airtable + Mixpanel
 
Try it
mixpanel.track with Mixpanel API on New or Modified Records in View from Airtable API
Airtable + Mixpanel
 
Try it
mixpanel.track with Mixpanel API on New or Modified Records from Airtable API
Airtable + Mixpanel
 
Try it
mixpanel.track with Mixpanel API on New Records in View from Airtable API
Airtable + Mixpanel
 
Try it
New or Modified Records from the Airtable API

Emit an event for each new or modified record in a table

 
Try it
New or Modified Records in View from the Airtable API

Emit an event for each new or modified record in a view

 
Try it
New Records from the Airtable API

Emit an event for each new record in a table

 
Try it
New Records in View from the Airtable API

Emit an event for each new record in a view

 
Try it
New, Modified or Deleted Records from the Airtable API

Emits an event each time a record is added, updated, or deleted in an Airtable table. Supports tables up to 10,000 records

 
Try it
Create single record with the Airtable API

Adds a record to a table.

 
Try it
Create Multiple Records with the Airtable API

Create one or more records in a table by passing an array of objects containing field names and values as key/value pairs.

 
Try it
List Records with the Airtable API

Retrieve records from a table with automatic pagination. Optionally sort and filter results.

 
Try it
List Records in View with the Airtable API

Retrieve records in a view with automatic pagination. Optionally sort and filter results.

 
Try it
Update record with the Airtable API

Update a single record in a table by Record ID.

 
Try it