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.5 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { simplybookAuth, makeJsonRpcCall, SimplybookAuth } from '../common';

export const findClient = createAction({
  auth: simplybookAuth,
  name: 'find_client',
  classification: 'SEARCH',
  displayName: 'Get Client List',
  description: 'Returns list of clients associated with company. Search by phone number, email address, or name.',
  audience: 'both',
  aiMetadata: { description: 'Lists clients of the SimplyBook.me company; an empty search string fetches all clients, while a non-empty value filters by phone, email, or name. Use to find a client or retrieve a client ID before booking, deleting, or filtering reports. Idempotent: read-only search with no side effects.', idempotent: true },
  props: {
    searchString: Property.ShortText({
      displayName: 'Search String',
      description: 'Search by phone number, email address, or name. Leave empty to get all clients.',
      required: false
    }),
    limit: Property.Number({
      displayName: 'Limit',
      description: 'Maximum number of clients to return. Leave empty for no limit.',
      required: false
    })
  },
  async run(context) {
    const auth = context.auth.props;
    const { searchString, limit } = context.propsValue;

    const params = [
      searchString || '',
      limit !== undefined ? limit : null
    ];

    const clients = await makeJsonRpcCall(auth, 'getClientList', params);

    return clients;
  }
});