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.1 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { bokioAuth } from '../common/auth';
import { makeRequest } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';

export const getAnInvoice = createAction({
  auth: bokioAuth,
  name: 'getAnInvoice',
  classification: 'READ',
  displayName: 'Get an invoice',
  description: 'Retrieve a specific invoice by its ID',
  audience: 'both',
  aiMetadata: { description: 'Retrieves a single invoice from a Bokio company by its invoice ID. Use when you already have the invoice ID and need its full details. Idempotent read-only lookup.', idempotent: true },
  props: {
    invoiceId: Property.ShortText({
      displayName: 'Invoice ID',
      description: 'The ID of the invoice to retrieve',
      required: true,
    }),
  },
  async run(context) {
    const { invoiceId } = context.propsValue;
    const { api_key, companyId } = context.auth.props;

    const response = await makeRequest(
      api_key,
      HttpMethod.GET,
      `/companies/${companyId}/invoices/${invoiceId}`
    );

    return response;
  },
});