@contio/partner-sdk - v1.7.1
    Preparing search index...

    Class PartnerUserClient

    Partner User API client for OAuth-authenticated user endpoints.

    Provides access to meetings, action items, calendar events, and user profile for the authenticated user. Requires an OAuth access token.

    const { oauth, user } = ContioPartnerSDK.forUser({
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    redirectUri: 'https://your-app.com/callback'
    });

    // After OAuth flow completes
    const meetings = await user.getMeetings({ limit: 10 });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    axiosInstance: AxiosInstance
    config: ClientConfig

    Methods

    • Internal

      Add authorization headers, automatically refreshing the token if expired.

      Parameters

      • config: InternalAxiosRequestConfig

      Returns Promise<InternalAxiosRequestConfig<any>>

    • Add a participant to a meeting.

      Parameters

      • meetingId: string

        The meeting ID to add the participant to

      • data: { email: string; name: string; role: "EDITOR" | "VIEWER" }

        Participant data including email, name, and role

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<MeetingParticipant>

      The newly added participant

      If the meeting is not found or participant already exists

    • Create a new action item.

      Parameters

      • data: CreateActionItemRequest

        Action item creation data

        • Optionaldescription?: string
        • Optionaldue_date?: string
        • meeting_id: string
        • Optionalpartner_context?: Record<string, unknown>
        • Optionalstatus?: ActionItemStatus
        • title: string
      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<ActionItem>

      The newly created action item

      If validation fails

      const item = await user.createActionItem({
      meeting_id: 'meeting-456',
      title: 'Follow up with client',
      due_date: '2026-01-25T17:00:00Z',
      status: 'needs_review'
      });
    • Create a new agenda item for a meeting.

      Parameters

      Returns Promise<AgendaItem>

      The newly created agenda item

      If the meeting is not found or validation fails

      const item = await user.createAgendaItem('meeting-id', {
      title: 'Review Q1 metrics',
      description: 'Discuss performance trends',
      });
    • Create a new chat session and submit the first user message.

      The agent begins processing immediately. The response includes the session and the initial user turn as current_turn. Listen for a session.turn.completed webhook to know when the agent response is ready, then call getSession to retrieve it.

      Requires the chat:write OAuth scope.

      Parameters

      Returns Promise<ChatSession>

      The newly created session with current_turn populated

      If validation fails or the meeting is not found

      const session = await user.createChatSession({
      meeting_id: 'meeting-uuid',
      message: 'Summarize the key decisions from this meeting.',
      metadata: { partner_ref: 'crm-case-4821' },
      });
      console.log('Session created:', session.id);
    • Delete an action item.

      Parameters

      • actionItemId: string

        The unique action item ID to delete

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<void>

      If the action item is not found or deletion is denied

    • Delete an agenda item.

      Parameters

      • meetingId: string

        The meeting ID the agenda item belongs to

      • itemId: string

        The agenda item ID to delete

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<void>

      If the item is not found

    • Delete a context document from a meeting.

      This performs a soft-delete — the document's deleted_at timestamp is set and it will no longer appear in list results or be available for download.

      Parameters

      • meetingId: string

        The meeting ID the document belongs to (UUID format)

      • documentId: string

        The context document ID to delete (UUID format)

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<void>

      If the document is not found or deletion is denied

      await user.deleteMeetingContextDocument('meeting-id', 'doc-id');
      
    • Download the raw content of a context document.

      Returns the file bytes along with metadata extracted from the response headers (filename, content type, size). The data field is an ArrayBuffer that can be written to disk, converted to a Buffer, or processed in-memory.

      Parameters

      • meetingId: string

        The meeting ID the document belongs to (UUID format)

      • documentId: string

        The context document ID to download (UUID format)

      • Optionaloptions: RequestOptions

        Optional request options (e.g., timezone override)

      Returns Promise<MeetingContextContentResponse>

      Structured response containing the file bytes and metadata

      If the document is not found or access is denied

      import { writeFile } from 'node:fs/promises';

      const content = await user.downloadMeetingContextDocumentContent(
      'meeting-id',
      'doc-id',
      );
      console.log(`Downloading ${content.filename} (${content.size} bytes)`);
      await writeFile(content.filename ?? 'download.bin', Buffer.from(content.data));
    • Ensure the OAuth access token is valid, refreshing if necessary.

      Call this before making API requests if you want to proactively refresh expired tokens rather than handling refresh on error.

      Returns Promise<void>

      If token refresh fails

      // Proactively refresh before a batch of operations
      await user.ensureValidToken();
      const meetings = await user.getMeetings();
      const items = await user.getActionItems();
    • Execute a next step for a meeting.

      Triggers the AI-powered execution of a next step, which may generate content based on the meeting transcript and the step's AI prompt.

      Parameters

      • meetingId: string

        The meeting ID

      • nextStepId: string

        The next step ID to execute

      • Optionaldata: ExecuteNextStepRequest

        Optional execution parameters

      • Optionaloptions: RequestOptions

        Request options

      Returns Promise<ExecuteNextStepResponse>

      Execution response with result ID for tracking

      If the meeting or next step is not found

      const result = await user.executeNextStep('meeting-uuid', 'step-uuid');
      console.log(`Execution started: ${result.result_id}`);

      // Poll for result
      const finalResult = await user.getNextStepResult(result.result_id);
      console.log(finalResult.content);
    • Get a specific action item by ID.

      Parameters

      • actionItemId: string

        The unique action item ID (UUID format)

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<ActionItem>

      The action item with full details

      If the action item is not found or access is denied

    • Get a paginated list of action items for the authenticated user.

      Parameters

      Returns Promise<ActionItemListResponse>

      Paginated action item list with total count

      If the request fails

      // Get all incomplete action items
      const items = await user.getActionItems({ is_completed: false });

      // Get action items for a specific meeting
      const meetingItems = await user.getActionItems({ meeting_id: 'meeting-uuid' });

      // Get action items within a date range
      const recent = await user.getActionItems({
      start_date: '2026-01-01',
      end_date: '2026-01-31',
      });
    • Get all action items by automatically paginating through all pages.

      Use this when you need to fetch all action items without manually handling pagination. For large datasets, consider using getActionItems() with pagination for better control.

      Parameters

      • Optionalparams: Omit<ActionItemListParams, "limit" | "offset">

        Optional filter parameters (limit/offset are managed automatically)

      • Optionaloptions: RequestOptions

        Optional request options (e.g., timezone override)

      Returns Promise<ActionItem[]>

      Array of all action items matching the filter criteria

      If any request fails

      // Get all incomplete action items
      const allItems = await user.getAllActionItems({ is_completed: false });
      console.log(`${allItems.length} items need attention`);

      // Get all action items for a meeting
      const meetingItems = await user.getAllActionItems({ meeting_id: 'meeting-uuid' });
    • Get all calendar events within a date range by automatically paginating through all pages.

      Parameters

      • params: Omit<CalendarEventListParams, "limit" | "offset">

        Required date range, optional direction (limit/offset managed automatically)

      • Optionaloptions: RequestOptions

        Optional request options (e.g., timezone override)

      Returns Promise<CalendarEvent[]>

      Array of all calendar events within the date range

      If calendar is not connected or request fails

      const allEvents = await user.getAllCalendarEvents({
      start_date: '2026-01-01T00:00:00Z',
      end_date: '2026-01-31T23:59:59Z'
      });
      console.log(`Found ${allEvents.length} events`);
    • Get all context documents for a meeting by automatically paginating through all pages.

      Parameters

      • meetingId: string

        The meeting ID to list context documents for (UUID format)

      • Optionaloptions: RequestOptions

        Optional request options (e.g., timezone override)

      Returns Promise<MeetingContextDocument[]>

      Array of all context documents for the meeting

      If any page request fails

      const allDocs = await user.getAllMeetingContextDocuments('meeting-id');
      console.log(`Total: ${allDocs.length} context documents`);
    • Get all meetings by automatically paginating through all pages.

      Parameters

      • Optionalparams: Omit<MeetingListParams, "limit" | "offset">

        Optional filter parameters (limit/offset are managed automatically)

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<Meeting[]>

      Array of all meetings matching the filter criteria

      If any request fails

      const allMeetings = await user.getAllMeetings();
      console.log(`${allMeetings.length} total meetings`);
    • Get detailed information about a specific calendar event.

      Parameters

      • calendarEventId: string

        The calendar event ID to retrieve

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<CalendarEventDetail>

      Complete calendar event details

      If the event is not found or user doesn't have access

      const event = await user.getCalendarEvent('cal-event-123');
      console.log(`Event: ${event.title}`);
      console.log(`Organizer: ${event.organizer?.email}`);
    • Get calendar events for the authenticated user within a time range.

      Requires the user to have connected their calendar via OAuth.

      Parameters

      • params: CalendarEventListParams

        Filter parameters

        • Optionaldirection?: string

          Sort direction: asc or desc (default: asc)

        • Optionalend?: string

          End time in RFC3339 format

          Use end_date instead. Will be removed in the next major version.

        • Optionalend_date?: string

          End date/time in ISO 8601 format (preferred over end)

        • Optionallimit?: number

          Number of results per page (default 25, max 100)

        • Optionaloffset?: number

          Pagination offset (default 0)

        • Optionalstart?: string

          Start time in RFC3339 format

          Use start_date instead. Will be removed in the next major version.

        • Optionalstart_date?: string

          Start date/time in ISO 8601 format (preferred over start)

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<CalendarEventListResponse>

      List of calendar events within the specified range

      If calendar is not connected or request fails

      const events = await user.getCalendarEvents({
      start_date: '2026-01-20T00:00:00Z',
      end_date: '2026-01-27T23:59:59Z'
      });
    • Get a specific chat session by ID, including its turns.

      By default returns only turns not yet seen by the caller (include: 'undelivered'). Pass include: 'all_turns' to retrieve the full conversation history.

      Requires the chat:read OAuth scope.

      Parameters

      • sessionId: string

        The unique session ID (UUID format)

      • Optionalparams: GetChatSessionParams

        Optional query parameters (include, turn_limit, turn_offset)

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<ChatSession>

      The session with its turns

      If the session is not found

      // Fetch full conversation history after receiving a webhook
      const session = await user.getChatSession('session-uuid', { include: 'all_turns' });
      for (const turn of session.turns?.items ?? []) {
      console.log(`[${turn.role}] ${turn.content}`);
      }
    • Retrieve a specific turn by ID within a session.

      This is useful when a turn_id is received via webhook and the partner wants to fetch only that turn instead of the full session history.

      Requires the chat:read OAuth scope.

      Parameters

      • sessionId: string

        The session ID that contains the turn

      • turnId: string

        The turn ID to retrieve

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<ChatTurn>

      The requested turn with full details

      If the session or turn is not found

      // Fetch a specific turn after receiving a webhook with turn_id
      const turn = await user.getChatTurn('session-uuid', 'turn-uuid');
      console.log(`[${turn.role}] ${turn.content}`);
    • Get a specific meeting by ID.

      Automatically follows smart-redirect references (CON-1640) — if the meeting has been merged or moved, the response from the canonical meeting is returned transparently.

      Parameters

      • meetingId: string

        The unique meeting ID (UUID format)

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<Meeting>

      The meeting with full details

      If the meeting is not found or access is denied

      const meeting = await user.getMeeting('meeting-uuid');
      console.log(meeting.title);
    • Get a specific context document by ID.

      Parameters

      • meetingId: string

        The meeting ID the document belongs to (UUID format)

      • documentId: string

        The context document ID to retrieve (UUID format)

      • Optionaloptions: RequestOptions

        Optional request options (e.g., timezone override)

      Returns Promise<MeetingContextDocument>

      The context document with full metadata

      If the document is not found or access is denied

      const doc = await user.getMeetingContextDocument('meeting-id', 'doc-id');
      console.log(`${doc.title} — format: ${doc.source_format}`);
    • Get a paginated list of context documents for a meeting.

      Returns only documents uploaded by the current partner application — documents created by other partners or by users directly are not visible.

      Parameters

      • meetingId: string

        The meeting ID to list context documents for (UUID format)

      • Optionalparams: MeetingContextListParams

        Optional pagination parameters

        Pagination parameters for listing meeting context documents.

        • Optionallimit?: number

          Maximum number of documents to return (default: 25, max: 100)

        • Optionaloffset?: number

          Number of documents to skip for pagination (default: 0)

      • Optionaloptions: RequestOptions

        Optional request options (e.g., timezone override)

      Returns Promise<MeetingContextListResponse>

      Paginated list of context documents with total count

      If the request fails

      const response = await user.getMeetingContextDocuments('meeting-id', {
      limit: 10,
      });
      console.log(`Found ${response.total} context documents`);
      for (const doc of response.items) {
      console.log(`${doc.title} (${doc.source_format})`);
      }
    • Get next steps for a specific meeting.

      Returns the next steps associated with the meeting, including any available action buttons for each next step.

      Parameters

      Returns Promise<MeetingNextStepListResponse>

      Paginated list of next steps

      If the meeting is not found

      const nextSteps = await user.getMeetingNextSteps('meeting-uuid');
      for (const step of nextSteps.items) {
      console.log(`${step.name}: ${step.action_buttons?.length ?? 0} buttons`);
      }
    • Get a specific meeting template.

      Parameters

      • templateId: string

        The unique template ID

      • Optionaloptions: RequestOptions

        Request options

      Returns Promise<UserMeetingTemplate>

      The meeting template with full details

      If the template is not found

    • Get meeting templates available to the user.

      Returns templates that the user can use to create meetings, including associated next steps and action buttons.

      Parameters

      • Optionalparams: UserMeetingTemplateListParams

        Optional pagination parameters

      • Optionaloptions: RequestOptions

        Request options

      Returns Promise<UserMeetingTemplateListResponse>

      Paginated list of meeting templates

      If the request fails

      const templates = await user.getMeetingTemplates({ limit: 10 });
      for (const t of templates.items) {
      console.log(`${t.name}: ${t.next_steps?.length ?? 0} next steps`);
      }
    • Make a GET request that returns the full AxiosResponse, including headers and raw data.

      Use this for endpoints that return binary content (e.g. file downloads) where the caller needs access to response headers such as Content-Disposition or Content-Type.

      Parameters

      • path: string

        Request path relative to the client's base URL

      • Optionalparams: object

        Optional query parameters

      • Optionaloptions: RequestOptions

        Optional per-request options (e.g. timezone override)

      • responseType: "arraybuffer" | "blob" | "stream" = 'arraybuffer'

        Axios response type (default: 'arraybuffer')

      Returns Promise<AxiosResponse<any, any, {}>>

      The full axios response

    • Get the authenticated user's profile.

      Parameters

      Returns Promise<UserProfile>

      The user's profile including name, email, and preferences

      If the request fails

      const profile = await user.getUserProfile();
      console.log(`Logged in as ${profile.name} (${profile.email})`);
    • Install a toolkit in the user's workspace.

      Creates all toolkit entities (templates, next steps, action buttons) in the user's workspace based on the toolkit manifest.

      Parameters

      • toolkitId: string

        The unique toolkit ID to install

      • Optionalparams: InstallToolkitParams
      • Optionaloptions: RequestOptions

        Request options

      Returns Promise<ToolkitInstallation>

      The installation record

      If the toolkit is not found or already installed

      const installation = await user.installToolkit('toolkit-uuid');
      console.log(`Installed at ${installation.installed_at}`);

    Protectedpost

    • Make a POST request with multipart/form-data.

      Overrides the default application/json content type so that axios sets the correct multipart/form-data boundary automatically.

      Type Parameters

      • T

      Parameters

      • path: string

        Request path relative to the client's base URL

      • formData: FormData

        A FormData instance containing the fields and files to upload

      • Optionaloptions: RequestOptions

        Optional per-request options (e.g. timezone override)

      Returns Promise<T>

      Parsed response body

    • Remove a participant from a meeting.

      Parameters

      • meetingId: string

        The meeting ID to remove the participant from

      • participantId: string

        The participant ID to remove

      • Optionaloptions: RequestOptions

        Optional request options

      Returns Promise<void>

      If the meeting or participant is not found

    • Enqueue a new user message as the next turn in an existing session.

      Returns immediately with the queued turn and its position in the processing queue. The agent processes all queued turns sequentially — wait for a session.turn.completed webhook before calling getChatSession.

      Requires the chat:write OAuth scope.

      Parameters

      Returns Promise<SendChatMessageResponse>

      The queued turn and its position in the processing queue

      If the session is not found, closed, or the turn limit is reached

      const { turn, position } = await user.sendChatMessage('session-uuid', {
      message: 'Create action items for each open question.',
      });
      console.log(`Turn ${turn.sequence_number} queued at position ${position}`);
    • Trigger an action button for a meeting.

      Executes the action associated with the button, which may send an email, create a document, trigger a webhook, or perform other actions.

      Parameters

      Returns Promise<TriggerActionButtonResponse>

      Trigger response with result information

      If the meeting or button is not found

      const result = await user.triggerActionButton('meeting-uuid', 'button-uuid');
      if (result.redirect_url) {
      window.open(result.redirect_url);
      }
    • Uninstall a toolkit from the user's workspace.

      Removes all toolkit-created entities from the user's workspace.

      Parameters

      • toolkitId: string

        The unique toolkit ID to uninstall

      • Optionaloptions: RequestOptions

        Request options

      Returns Promise<void>

      If the toolkit is not found or not installed

      await user.uninstallToolkit('toolkit-uuid');
      console.log('Toolkit uninstalled');
    • Update an existing action item.

      Parameters

      Returns Promise<ActionItem>

      The updated action item

      If the action item is not found or update is denied

      // Mark as completed
      const updated = await user.updateActionItem('item-id', {
      status: 'completed'
      });
    • Upload a context document to a meeting.

      The file is sent as multipart/form-data. The SDK handles FormData construction automatically — callers supply a plain request object.

      Parameters

      • meetingId: string

        The meeting ID to attach the document to (UUID format)

      • data: UploadMeetingContextRequest

        Upload parameters including the file, source format, and optional metadata

        Parameters for uploading a meeting context document.

        The file field accepts any Blob-compatible value — in Node.js ≥ 22 this includes Buffer, File, and Blob instances. The SDK converts the request into a multipart/form-data upload automatically.

        • Optionalcontext_type?: string

          Logical context type — a free-form partner-defined category.

          `"agenda"`, `"crm_record"`, `"project_brief"`
          
        • file: Blob

          Document file contents

        • source_format: ContextSourceFormat

          Source format of the file.

          Must match the actual content — the server validates the file against this declaration.

        • Optionaltitle?: string

          Human-readable document title (defaults to the filename if omitted)

      • Optionaloptions: RequestOptions

        Optional request options (e.g., timezone override)

      Returns Promise<MeetingContextDocument>

      The newly created context document

      If the meeting is not found, validation fails, or upload is denied

      import { readFile } from 'node:fs/promises';

      const buffer = await readFile('./agenda.md');
      const doc = await user.uploadMeetingContextDocument('meeting-id', {
      file: new Blob([buffer]),
      source_format: 'md',
      title: 'Sprint planning agenda',
      context_type: 'agenda',
      });
      console.log(`Uploaded: ${doc.id}`);