Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Amplitude

Amplitude

Product analytics: event segmentation, active users, session metrics and user lookups (US data residency).

6 actions API key 6 read0 write Calls amplitude.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "amplitude" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

This toolkit uses a single credential and requests no scopes.

Actions

Get active or new usersreadamplitude.active_usersGet counts of active or new users over a date range, per day, week or month.
InputTypeDescription
startstringRequiredStart date, YYYYMMDD
endstringRequiredEnd date, YYYYMMDD
metricstringOptionalWhich users
intervalintegerOptionalBucket: 1 day, 7 week, 30 month
TypeScript
await setu.execute({
  userId: "user_1",
  action: "amplitude.active_users",
  input: {
    "start": "<start>",
    "end": "<end>"
  },
});
Get average session lengthreadamplitude.average_session_lengthGet the average session length in seconds per day over a date range.
InputTypeDescription
startstringRequiredStart date, YYYYMMDD
endstringRequiredEnd date, YYYYMMDD
TypeScript
await setu.execute({
  userId: "user_1",
  action: "amplitude.average_session_length",
  input: {
    "start": "<start>",
    "end": "<end>"
  },
});
Event segmentationreadamplitude.event_segmentationCount one event over a date range as uniques, totals or other metrics, bucketed by day, week or month.
InputTypeDescription
event_typestringRequiredEvent type name, e.g. watch_tutorial
startstringRequiredStart date, YYYYMMDD
endstringRequiredEnd date, YYYYMMDD
metricstringOptionalMetric
intervalintegerOptionalBucket size: 1 (day), 7 (week) or 30 (month)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "amplitude.event_segmentation",
  input: {
    "event_type": "<event_type>",
    "start": "<start>",
    "end": "<end>"
  },
});
Get user activityreadamplitude.get_user_activityGet the event stream and summary for one user by Amplitude id (limits are zero-based, so limit=1 returns two events).
InputTypeDescription
userstringRequiredAmplitude id of the user
limitintegerOptionalMaximum events (up to 1000)
offsetintegerOptionalEvents to skip
directionstringOptionalOrder
TypeScript
await setu.execute({
  userId: "user_1",
  action: "amplitude.get_user_activity",
  input: {
    "user": "<user>"
  },
});
Get real-time active usersreadamplitude.realtime_active_usersGet active users in 5-minute buckets for today and yesterday.

No input.

TypeScript
await setu.execute({
  userId: "user_1",
  action: "amplitude.realtime_active_users",
  input: {},
});
Search for a userreadamplitude.search_userFind a user by Amplitude id, device id, user id or user id prefix. Returns matching Amplitude ids.
InputTypeDescription
userstringRequiredAmplitude id, device id, user id or user id prefix
TypeScript
await setu.execute({
  userId: "user_1",
  action: "amplitude.search_user",
  input: {
    "user": "<user>"
  },
});