Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

691 B
Raw Blame
import { HttpMethod } from '@activepieces/pieces-common';
import { heartbeatApi } from './client';

async function getGroup({ token, groupId }: { token: string; groupId: string }): Promise<Record<string, unknown>> {
  return heartbeatApi.request<Record<string, unknown>>({
    token,
    method: HttpMethod.GET,
    path: `/groups/${groupId}`,
    operation: 'get group',
  });
}

function memberEmails(group: Record<string, unknown>): Set<string> {
  return new Set(
    heartbeatApi
      .recordList(group['users'])
      .flatMap((user) => (typeof user['email'] === 'string' ? [user['email'].toLowerCase()] : [])),
  );
}

export const heartbeatGroups = {
  getGroup,
  memberEmails,
};