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 { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { aiprise } from '../common';
import { aipriseAuth } from '../common/auth';

export const getVerificationUrlAction = createAction({
  auth: aipriseAuth,
  name: 'get_verification_url',
  classification: 'WRITE',
  displayName: 'Get Identity Verification Link',
  description:
    'Generates a secure link you can send to a person so they can complete their identity verification on an AiPrise-hosted page — no extra development needed.',
  audience: 'both',
  aiMetadata: {
    description:
      'Creates a unique hosted-verification URL for a given template that you can send to a person so they complete their identity (KYC) check on an AiPrise-hosted page. Use this for the no-code/self-service flow instead of collecting data yourself. Requires a template ID and a redirect URL the person returns to afterward. Not idempotent — each call mints a new verification link/session.',
    idempotent: false,
  },
  props: {
    template_id: Property.ShortText({
      displayName: 'Verification Template',
      description:
        'Which set of checks the person will go through. To find this: log in to AiPrise → go to **Templates** → open the template you want → copy the **Template ID** shown at the top of the page.',
      required: true,
    }),
    redirect_uri: Property.ShortText({
      displayName: 'Redirect URL',
      description:
        'The page the person will be sent to after they finish the verification on the AiPrise-hosted form (e.g. a "Thank you" or confirmation page on your website).',
      required: true,
    }),
  },
  async run(context) {
    const { template_id, redirect_uri } = context.propsValue;
    const result = await aiprise.makeRequest<Record<string, unknown>>({
      auth: context.auth.props,
      method: HttpMethod.POST,
      path: '/verify/get_user_verification_url',
      body: {
        template_id,
        redirect_uri,
      },
    });
    return result;
  },
});