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 { respondIoAuth } from '../common/auth';

export const conversationClosedTrigger = createTrigger({
  name: 'conversation_closed',
  displayName: 'Conversation Closed',
  description: 'Triggers when a conversation is closed.',
  aiMetadata: {
    description: 'Fires when a conversation is closed in Respond.io, delivering the contact and conversation that was closed. Use to run follow-up actions after a conversation is resolved. Requires manually configuring a conversation.closed webhook in Respond.io.',
  },
  auth: respondIoAuth,
  props: {
    webhookInstructions: Property.MarkDown({
      value: `
			To use this trigger, you need to manually set up a webhook in your Respond.io account:

			1. Login to your Respond.io account.
			2. Go to Settings > Integrations > Webhooks.
			3. Click on "Add Webhook" or "Create New Webhook".
			4. Add the following URL in the **Webhook URL** field:
			\`\`\`text
			{{webhookUrl}}
			\`\`\`
			5. Select **conversation.closed** from the event types.
			6. Click Save to create the webhook.
			`,
    }),
  },
  type: TriggerStrategy.WEBHOOK,
  sampleData: undefined,
  async onEnable(context) {
    // No need to register webhooks programmatically as user will do it manually
  },
  async onDisable(context) {
    // No need to unregister webhooks as user will do it manually
  },

  async run(context) {
    return [context.payload.body];
  },
});