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.2 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { pubrioAuth } from '../../index';
import { pubrioRequest } from '../common';

export const lookupAdvertisement = createAction({
  auth: pubrioAuth,
  name: 'lookup_advertisement',
  classification: 'READ',
  displayName: 'Lookup Advertisement',
  description:
    'Look up detailed advertisement information by advertisement search ID',
  audience: 'both',
  aiMetadata: {
    description:
      'Fetch the full detail of one advertisement given an advertisement_search_id (obtained from Search Advertisements). Read-only and repeatable. Use after Search Advertisements to expand a single ad result.',
    idempotent: true,
  },
  props: {
    advertisement_search_id: Property.ShortText({
      displayName: 'Advertisement Search ID',
      required: true,
      description: 'The advertisement search ID to look up',
    }),
  },
  async run(context) {
    const body: Record<string, unknown> = {
      advertisement_search_id: context.propsValue.advertisement_search_id,
    };
    return await pubrioRequest(
      context.auth.secret_text,
      HttpMethod.POST,
      '/companies/advertisements/lookup',
      body
    );
  },
});