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 { HttpMethod } from '@activepieces/pieces-common';
import { zendeskAuth } from '../../../auth';
import { zendeskApi } from '../../../common/api';
import { zendeskSearchTicketTriggersOutputSchema } from '../../../output-schemas';

export const zendeskSearchTicketTriggers = createAction({
  auth: zendeskAuth,
  name: 'zendesk_search_ticket_triggers',
  outputSchema: zendeskSearchTicketTriggersOutputSchema,
  displayName: 'Search Ticket Triggers',
  description: 'Search ticket triggers by title.',
  audience: 'ai',
  classification: 'SEARCH',
  aiMetadata: {
    description:
      'Finds ticket triggers whose title matches the query. Requires an admin.',
    idempotent: true,
  },
  props: {
    query: Property.ShortText({ displayName: 'Query', description: 'Text to match against trigger titles.', required: true }),
    active: Property.StaticDropdown({
      displayName: 'Active',
      description: 'Filter by active (Yes) or inactive (No). Omit for both.',
      required: false,
      options: { options: [{ label: 'Yes', value: 'true' }, { label: 'No', value: 'false' }] },
    }),
  },
  async run({ auth, propsValue }) {
    const response = await zendeskApi.request<{ triggers: unknown[] }>({
      auth,
      method: HttpMethod.GET,
      path: `/triggers/search.json`,
      queryParams: zendeskApi.query({ query: propsValue.query, active: propsValue.active }),
    });
    return { triggers: response.triggers, count: response.triggers.length };
  },
});