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

1.9 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { granolaAuth } from '../../';
import {
  granolaApiCall,
  flattenNoteWithTranscript,
  GranolaNote,
} from '../common';

export const getNoteAction = createAction({
  auth: granolaAuth,
  name: 'get_note',
  classification: 'READ',
  displayName: 'Get Note',
  description: 'Retrieve a single meeting note by its ID, with optional transcript.',
  audience: 'both',
  aiMetadata: {
    description:
      'Fetches one Granola meeting note by its note ID, including title, owner, calendar/attendee details, and AI summary. Enable the include-transcript option to also return the full speaker-by-speaker meeting transcript. Use it after List Notes (or a note trigger) to read a specific note in depth. Requires a valid note ID (format `not_` followed by 14 characters). Read-only and idempotent.',
    idempotent: true,
  },
  props: {
    note_id: Property.ShortText({
      displayName: 'Note ID',
      description:
        'The ID of the note to retrieve. Starts with `not_` followed by 14 characters (e.g. `not_1d3tmYTlCICgjy`). You can get this from the **List Notes** action.',
      required: true,
    }),
    include_transcript: Property.Checkbox({
      displayName: 'Include Transcript',
      description:
        'Include the full meeting transcript in the response. The transcript shows who said what and when.',
      required: false,
      defaultValue: false,
    }),
  },
  async run(context) {
    const queryParams: Record<string, string> = {};
    if (context.propsValue.include_transcript) {
      queryParams['include'] = 'transcript';
    }

    const response = await granolaApiCall<GranolaNote>({
      token: context.auth.secret_text,
      method: HttpMethod.GET,
      path: `/notes/${context.propsValue.note_id}`,
      queryParams,
    });

    return flattenNoteWithTranscript(response.body);
  },
});