AGENT SKILL

persona-core-workflow-a

Build a complete KYC verification flow with Persona inquiries and embedded UI. Use when implementing identity verification, building KYC onboarding, or integrating Persona's hosted flow into your application. Trigger with phrases like "persona KYC flow", "identity verification", "persona inquiry workflow", "onboarding verification".

License 许可
MIT
最近更新
2026-07-13
Stars
★ 1
Forks
0

01 前言 Front Matter

name
persona-core-workflow-a
tags
[ "saas", "persona", "kyc", "verification", "onboarding" ]
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
2.0.0
description
Build a complete KYC verification flow with Persona inquiries and embedded UI. Use when implementing identity verification, building KYC onboarding, or integrating Persona's hosted flow into your application. Trigger with phrases like "persona KYC flow", "identity verification", "persona inquiry workflow", "onboarding verification".
allowed-tools
Read, Write, Edit, Bash(npm:*), Grep
compatible-with
claude-code, codex, openclaw

03 SKILL.md 正文

Persona Core Workflow A — KYC Inquiry Flow

Overview

Build a complete KYC onboarding flow: create an inquiry from a template, embed the Persona verification UI in your web app, handle completion callbacks, and store verification results.

Prerequisites

  • Completed persona-install-auth setup
  • Inquiry Template configured in Persona Dashboard
  • Web application with a frontend (React, HTML, etc.)

Instructions

Step 1: Backend — Create Inquiry Endpoint

// server.ts — Express endpoint to create inquiries
import express from 'express';
import axios from 'axios';

const app = express();
app.use(express.json());

const persona = axios.create({
  baseURL: 'https://withpersona.com/api/v1',
  headers: {
    'Authorization': `Bearer ${process.env.PERSONA_API_KEY}`,
    'Persona-Version': '2023-01-05',
  },
});

app.post('/api/verify', async (req, res) => {
  const { userId, email } = req.body;

  const { data } = await persona.post('/inquiries', {
    data: {
      attributes: {
        'inquiry-template-id': process.env.PERSONA_TEMPLATE_ID,
        'reference-id': userId,
        'fields': {
          'email-address': { type: 'string', value: email },
        },
      },
    },
  });

  res.json({
    inquiryId: data.data.id,
    sessionToken: data.data.attributes['session-token'],
  });
});

Step 2: Frontend — Embed Persona Flow

<!-- Include Persona's JavaScript SDK -->
<script src="https://cdn.withpersona.com/dist/persona-v5.0.0.js"></script>

<button id="verify-btn">Verify Identity</button>

<script>
document.getElementById('verify-btn').addEventListener('click', async () => {
  // Get inquiry from your backend
  const resp = await fetch('/api/verify', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ userId: 'user-123', email: 'alice@example.com' }),
  });
  const { inquiryId, sessionToken } = await resp.json();

  // Launch Persona embedded flow
  const client = new Persona.Client({
    inquiryId,
    sessionToken,
    onComplete: ({ inquiryId, status }) => {
      console.log(`Verification ${status} for inquiry ${inquiryId}`);
      // Notify your backend
      fetch(`/api/verify/${inquiryId}/complete`, { method: 'POST' });
    },
    onCancel: ({ inquiryId }) => {
      console.log('User cancelled verification');
    },
    onError: (error) => {
      console.error('Persona error:', error);
    },
  });

  client.open();
});
</script>

Step 3: Backend — Handle Completion

app.post('/api/verify/:inquiryId/complete', async (req, res) => {
  const { inquiryId } = req.params;

  // Fetch the completed inquiry from Persona
  const { data } = await persona.get(`/inquiries/${inquiryId}`);
  const attrs = data.data.attributes;

  const result = {
    inquiryId,
    status: attrs.status,                    // completed, approved, declined
    referenceId: attrs['reference-id'],      // your user ID
    createdAt: attrs['created-at'],
    completedAt: attrs['completed-at'],
  };

  // Store in your database
  await db.users.update(result.referenceId, {
    kycStatus: result.status,
    kycInquiryId: result.inquiryId,
    kycCompletedAt: result.completedAt,
  });

  res.json({ status: result.status });
});

Step 4: Resume Incomplete Inquiries

app.get('/api/verify/resume/:userId', async (req, res) => {
  // Find existing incomplete inquiry for this user
  const { data } = await persona.get('/inquiries', {
    params: {
      'filter[reference-id]': req.params.userId,
      'filter[status]': 'created',
      'page[size]': 1,
    },
  });

  if (data.data.length > 0) {
    const inquiry = data.data[0];
    // Resume the existing inquiry instead of creating a new one
    const resumeResp = await persona.post(`/inquiries/${inquiry.id}/resume`);
    res.json({
      inquiryId: inquiry.id,
      sessionToken: resumeResp.data.data.attributes['session-token'],
    });
  } else {
    res.json({ message: 'No pending inquiry' });
  }
});

Output

  • Backend endpoint creating inquiries from templates
  • Embedded Persona verification UI in web app
  • Completion callback storing verification results
  • Resume flow for incomplete verifications

Error Handling

Error Cause Solution
422 Invalid template Wrong template ID Verify itmpl_* in Dashboard
SDK not loading CSP blocking CDN Add cdn.withpersona.com to CSP
onComplete not firing User abandoned flow Use onCancel handler
Stale session token Token expired Create new inquiry or resume

Resources

Next Steps

  • Add verification checks: persona-core-workflow-b
  • Set up webhooks: persona-webhooks-events

04 同仓库更多 Skills

jukeyman
jukeyman/jukeyman-skills

zustand-store-creator

Create zustand store creator operations. Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like "zustand store creator", "zustand creator", "zustand".

★ 1
jukeyman
jukeyman/jukeyman-skills

zero-trust-config-helper

Configure with zero trust config helper operations. Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like "zero trust config helper", "zero helper", "zero".

★ 1
jukeyman
jukeyman/jukeyman-skills

zapier-integration-helper

Assist with zapier integration helper operations. Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like "zapier integration helper", "zapier helper", "zapier".

★ 1
jukeyman
jukeyman/jukeyman-skills

yaml-config-validator

Validate yaml config validator operations. Auto-activating skill for DevOps Basics. Triggers on: yaml config validator, yaml config validator Part of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like "yaml config validator", "yaml validator", "yaml".

★ 1
jukeyman
jukeyman/jukeyman-skills

xvary-stock-research

Thesis-driven equity analysis from public SEC EDGAR and market data; /analyze, /score, /compare workflows with bundled Python tools (Claude Code, Cursor, Codex).

★ 1
jukeyman
jukeyman/jukeyman-skills

xss-vulnerability-scanner

Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals. Triggers on: xss vulnerability scanner, xss vulnerability scanner Part of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like "xss vulnerability scanner", "xss scanner", "xss".

★ 1