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 { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
import { instantlyAiAuth } from '../auth';

export const campaignStatusChangedTrigger = createTrigger({
  auth: instantlyAiAuth,
  name: 'campaign_status_changed',
  classification: 'READ',
  displayName: 'Campaign Status Changed',
  description: 'Triggers when a campaign status changes (completed, paused, etc.).',
  aiMetadata: {
    description: 'Fires when an Instantly campaign changes status (for example completed or paused), delivering the campaign event details. Requires a webhook to be configured manually in Instantly settings pointing at the provided webhook URL.',
  },
  props: {
    md: Property.MarkDown({
      value: `
      To use this trigger, manually set up a webhook in Instantly.ai:

      1. Go to Instantly settings.
      2. Navigate to Integrations tab and find webhooks.
      3. Click "Add Webhook".
      4. Enter the webhook URL provided below:
          \`\`\`text
          {{webhookUrl}}
          \`\`\`
      5. Select the campaign and event type "Campaign Completed".
      6. Click "Add Webhook".
      `,
    }),
  },
  type: TriggerStrategy.WEBHOOK,
  sampleData: {
    timestamp: "2023-08-22T15:45:30.123Z",
    event_type: "campaign_completed",
    campaign_name: "Product Demo Campaign",
    workspace: "workspace_123456",
    campaign_id: "campaign_789012"
  },
  async onEnable(context) {
    // Empty
  },
  async onDisable(context) {
    // Empty
  },
  async run(context) {
    return [context.payload.body];
  },
});