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

2.7 KB
Raw Blame
import { createPiece, OAuth2PropertyValue, PieceAuth, PiecePropValueSchema, Property } from "@activepieces/pieces-framework";
import { findInvoiceAction } from "./actions/find-invoice";
import { findCustomerAction } from "./actions/find-customer";
import { findPaymentAction } from "./actions/find-payment";
import { createInvoiceAction } from "./actions/create-invoice";
import { createExpenseAction } from "./actions/create-expense";
import { createBillAction } from "./actions/create-bill";
import { createVendorAction } from "./actions/create-vendor";
import { findVendorAction } from "./actions/find-vendor";
import { findAccountAction } from "./actions/find-account";
import { recordPaymentAction } from "./actions/record-payment";
import { recordBillPaymentAction } from "./actions/record-bill-payment";
import { readAgingReportAction } from "./actions/read-aging-report";
import { newInvoice } from "./triggers/new-invoice";
import { newExpense } from "./triggers/new-expense";
import { newCustomer } from "./triggers/new-customer";
import { newDeposit } from "./triggers/new-deposit";
import { newTransfer } from "./triggers/new-transfer";
import { newOrUpdatedInvoice } from "./triggers/new-or-updated-invoice";
import { paymentReceived } from "./triggers/payment-received";
import { newBill } from "./triggers/new-bill";
import { createCustomApiCallAction } from "@activepieces/pieces-common";
import { quickbooksCommon } from "./lib/common";
import { quickbooksAuth } from './lib/auth';

export const quickbooks = createPiece({
  displayName: "Quickbooks Online",
  auth: quickbooksAuth,
  minimumSupportedRelease: '0.36.1',
  logoUrl: "https://cdn.activepieces.com/pieces/quickbooks.png",
  authors: [ 'onyedikachi-david', 'sanket-a11y'],
  actions: [
    findInvoiceAction,
    findCustomerAction,
    findPaymentAction,
    createInvoiceAction,
    createExpenseAction,
    createBillAction,
    createVendorAction,
    findVendorAction,
    findAccountAction,
    recordPaymentAction,
    recordBillPaymentAction,
    readAgingReportAction,
    createCustomApiCallAction({
      auth:quickbooksAuth,
      baseUrl:(auth)=>{
        const authValue = auth as PiecePropValueSchema<typeof quickbooksAuth>;
        const companyId = authValue.props?.['companyId'];
        
          const apiUrl = quickbooksCommon.getApiUrl(companyId);
          return apiUrl

      },
      authMapping:async (auth)=>{
          return {
            Authorization:`Bearer ${(auth as OAuth2PropertyValue).access_token}`
          }
        }
    })
  ],
  triggers: [
    newInvoice,
    newExpense,
    newCustomer,
    newDeposit,
    newTransfer,
    newOrUpdatedInvoice,
    paymentReceived,
    newBill
  ],
});