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

2.0 KB
Raw Blame
import {
  createTrigger,
  Property,
  TriggerStrategy,
} from '@activepieces/pieces-framework';

export const missedCall = createTrigger({
  name: 'missedCall',
  displayName: 'Missed Call',
  description: 'Triggered when an incoming call is not answered (missed call)',
  aiMetadata: {
    description:
      'Fires when an incoming VoIPstudio call goes unanswered, representing a missed call with its source, destination, and no-answer cause. Requires the Missed Call webhook event to be enabled in the VoIPstudio integrations panel.',
  },
  props: {
    instruction: Property.MarkDown({
      value: `
          1. Login to https://voipstudio.com/
          2. Click on **Integrations**
          3. Scroll down to **Webhooks** and Enable
          4. Select **Add Webhook** to create a new one
          5. Enter any name for the new Webhook to identify
          6. Select events to listen for. Select **Missed Call** event
          7. Enter the following URL in the webhook configuration
	\`\`\`text
			{{webhookUrl}}
			\`\`\`

                `,
    }),
  },
  sampleData: {
    id: 'uk003.608920d55f7ac3.77053295',
    event_time: '2021-04-28 08:46:13',
    event_name: 'call.missed',
    call_id: 139543232,
    state: 'MISSED',
    connected_at: null,
    start_time: '2021-04-28 08:45:55',
    context: 'LOCAL_USER',
    destination: 'in',
    duration: 0,
    t_cause: 'No Answer',
    src: '447854740947',
    src_id: '0',
    src_name: '"442035141598" <2035141598>',
    src_hash: 'fe5935cefbc82fc4e924bdaa21342a49c18c5dd9',
    dst: '441183211001',
    dst_id: '10002',
    dst_name: 'John Smith',
    terminated_by: 'caller',
  },
  type: TriggerStrategy.WEBHOOK,
  async onEnable(context) {
    // VoIPStudio webhooks are configured manually in the admin panel
    // This trigger will receive POST requests when a call is missed
  },
  async onDisable(context) {
    // VoIPStudio webhooks are disabled manually in the admin panel
  },
  async run(context) {
    return [context.payload.body];
  },
});