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

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

async function listChannels({ token }: { token: string }): Promise<Record<string, unknown>[]> {
  return heartbeatApi.recordList(
    await heartbeatApi.request<unknown>({ token, method: HttpMethod.GET, path: '/channels', operation: 'list channels' }),
  );
}

async function findChannel({ token, channelId }: { token: string; channelId: string }): Promise<Record<string, unknown> | null> {
  const channels = await listChannels({ token });
  return channels.find((channel) => channel['id'] === channelId) ?? null;
}

export const heartbeatChannels = {
  listChannels,
  findChannel,
};