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.3 KB
Raw Blame
import {
  createTrigger,
  Property,
  TriggerStrategy,
} from '@activepieces/pieces-framework';
import { veroAuth } from '../common/auth';
export const resubscribeUserTrigger = createTrigger({
  auth: veroAuth,
  name: 'resubscribeUser',
  displayName: 'Resubscribe User',
  description: '',
  aiMetadata: {
    description:
      'Fires when a user resubscribes to communications in Vero, representing restored consent for a specific user after a prior unsubscribe.',
  },
  props: {
    instruction: Property.MarkDown({
      value: `## Vero Webhook Setup
                        To enable the webhooks, go to **Settings** > **Integrations** > **Webhooks** and enter the URL at which you wish to receive the webhooks.
                        
                        \`\`\`text
                        {{webhookUrl}}
                        \`\`\`
                        `,
    }),
  },
  sampleData: {
    type: 'resubscribed',
    user: {
      id: 123,
      email: '[email protected]',
    },
  },
  type: TriggerStrategy.WEBHOOK,
  async onEnable(context) {
    // implement webhook creation logic
  },
  async onDisable(context) {
    // implement webhook deletion logic
  },
  async run(context) {
    const body = context.payload.body as any;
    if (body.type === 'resubscribed') {
      return [body];
    }
    return [];
  },
});