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.7 KB
Raw Blame
import { createPiece, PieceAuth, PiecePropValueSchema } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/pieces-framework';
import { leadStatusChangedTrigger, newContactAddedTrigger, newLeadCreatedTrigger, newTaskCreatedTrigger } from "./lib/triggers";
import { findLeadAction, updateContactAction, createLeadAction, createContactAction, findContactAction, findCompanyAction, updateLeadAction } from "./lib/actions";
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { kommoAuth } from './lib/auth';

const markdownDescription = `
Please follow [Generate Long Live Token](https://developers.kommo.com/docs/long-lived-token) guide for generating token.

Your Kommo account subdomain (e.g., "mycompany" if your URL is mycompany.kommo.com).

`;

export const kommo = createPiece({
  displayName: 'Kommo',
  auth: kommoAuth,
  logoUrl: 'https://cdn.activepieces.com/pieces/kommo.png',
  categories: [PieceCategory.COMMUNICATION, PieceCategory.SALES_AND_CRM],
  authors: ['krushnarout', 'kishanprmr'],
  actions: [findLeadAction, updateContactAction, createLeadAction, updateLeadAction, createContactAction, findContactAction, findCompanyAction,
    createCustomApiCallAction({
      auth: kommoAuth,
      baseUrl: (auth) => {
        if (!auth) {
          return '';
        }
        const authValue = auth.props;
        return `https://${authValue.subdomain}.kommo.com/api/v4`
      },
      authMapping: async (auth) => {
        const authValue = auth.props;
        return {
          Authorization: `Bearer ${authValue.apiToken}`
        }

      }
    })
  ],
  triggers: [leadStatusChangedTrigger, newContactAddedTrigger, newLeadCreatedTrigger, newTaskCreatedTrigger],
});