Skip to main content

Orchestrating Adaptive Friction with Didit & Temporal.io

Discover how to build robust, adaptive identity verification workflows using Didit's API and Temporal.io for TypeScript developers. This guide covers integrating multi-step KYC, liveness, and AML checks, ensuring seamless user.

Orchestrating Adaptive Friction with Didit & Temporal.io

Contents

In this guide

Jump to the part you need.

Dynamic Verification FlowImplement adaptive identity verification by dynamically adjusting friction based on real-time risk assessments, ensuring a balanced approach to security and user experience.

Temporal.io for State ManagementUtilize Temporal.io's durable execution to manage complex, long-running identity verification workflows, handling retries, timeouts, and human intervention seamlessly across distributed systems.

Didit's API for Core Identity ChecksIntegrate Didit's comprehensive suite of identity verification products, including ID Verification, Liveness, and AML Screening, through clean APIs to power the core components of your adaptive workflows.

Modular & AI-Native AdvantageDidit's modular, AI-native architecture and no-code Business Console enable rapid deployment and customization of workflows, offering Core KYC and no setup fees for scalable identity solutions.

The Challenge of Adaptive Friction in Identity Verification

In today's digital landscape, balancing user experience with robust security is paramount. Traditional, static identity verification processes often fail to adapt to varying risk profiles, leading to either excessive friction for low-risk users or insufficient security for high-risk ones. The ideal solution involves an adaptive friction model, where the level of verification effort dynamically adjusts based on contextual factors and real-time risk assessments. This requires sophisticated orchestration, managing multi-step processes, potential human reviews, and asynchronous data flows.

Building such a system from scratch presents significant challenges, especially for TypeScript developers working within distributed environments. You need to manage state across long-running processes, handle failures gracefully, implement retries, and integrate various identity checks seamlessly. This is where the powerful combination of Didit's AI-native identity platform and Temporal.io's durable execution comes into play.

Temporal.io: The Orchestration Layer for Complex Workflows

Temporal.io is a powerful open-source platform for building and operating fault-tolerant, scalable distributed applications. For identity verification, it acts as the perfect orchestration layer, allowing developers to define complex, long-running workflows as code. Imagine a user onboarding journey that might involve:

  1. Initial ID Verification (Didit's OCR, MRZ, barcodes)
  2. Passive & Active Liveness checks for fraud prevention
  3. 1:1 Face Match against the document photo
  4. Conditional AML Screening based on initial risk scores
  5. Optional Proof of Address or Phone & Email Verification
  6. Potential manual review by an agent if automated checks flag anomalies

Each of these steps can be an activity in a Temporal workflow. Temporal ensures that even if your services crash, network requests fail, or external APIs are temporarily unavailable, the workflow state is preserved, and execution resumes exactly where it left off. This is critical for maintaining a smooth user journey and ensuring compliance, especially for processes that might span minutes, hours, or even days due to human intervention.

With TypeScript, you can define your Temporal workflows and activities with strong typing, improving code quality and maintainability. This allows you to model your adaptive friction logic directly within your workflow definitions, making it easier to implement conditional branching and dynamic adjustments to verification steps.

Integrating Didit's API for Core Identity Checks

Didit provides the foundational building blocks for all your identity verification needs, delivered via clean APIs. Integrating Didit into your Temporal workflows is straightforward. For instance, when a user initiates a verification session, your Temporal workflow can call Didit's API to create a session for a specific workflow ID. Didit's Business Console allows you to create these workflows easily, combining features like ID Verification, Passive & Active Liveness, and AML Screening & Monitoring. You can even use Didit's Age Estimation for age-gated services or NFC Verification for enhanced security.

Didit's API offers a workflow_id parameter when creating a session, allowing you to trigger pre-configured verification flows. Your Temporal workflow can then listen for webhooks from Didit, which notify your system about the status and results of each verification step or the overall session completion. This asynchronous communication is perfectly handled by Temporal's event-driven architecture, eliminating the need for complex polling logic.

For example, a Temporal activity could be responsible for initiating a Didit session and waiting for a specific webhook event. If the webhook indicates a successful ID verification but a low-confidence liveness score, your workflow could then conditionally trigger an additional step, such as a manual review activity or a request for more evidence, demonstrating true adaptive friction.

Building Adaptive Friction Workflows with TypeScript

Let's consider a practical example. A new user signs up for a financial service. Instead of a one-size-fits-all KYC process, we want to adapt. Low-risk users (e.g., from trusted IP addresses, low transaction value) might only require basic ID Verification and Passive Liveness. High-risk users (e.g., from suspicious IPs, high transaction value, or previous fraud flags) might require NFC Verification, Active Liveness, AML Screening, and a mandatory manual review.

Using Temporal with TypeScript, you can define a main workflow that takes user context as input. This workflow can then use conditional logic to select different Didit workflow IDs or chain multiple Didit API calls based on the risk assessment. For instance:


// Example Temporal Workflow snippet
import { proxyActivities } from '@temporalio/workflow';
import type * as activities from './activities';

const { initiateDiditSession, waitForDiditWebhook, performManualReview } = proxyActivities({ startToCloseTimeout: '5 minutes' });

export async function onboardingWorkflow(userId: string, riskScore: number): Promise<string> {
  let diditWorkflowId: string;

  if (riskScore < 30) {
    // Low risk: Basic KYC with passive liveness
    diditWorkflowId = 'uuid-for-basic-kyc-workflow';
  } else if (riskScore < 70) {
    // Medium risk: Standard KYC with active liveness and face match
    diditWorkflowId = 'uuid-for-standard-kyc-workflow';
  } else {
    // High risk: Enhanced KYC with NFC, AML, and manual review
    diditWorkflowId = 'uuid-for-enhanced-kyc-workflow';
  }

  const sessionId = await initiateDiditSession(userId, diditWorkflowId);
  const verificationResult = await waitForDiditWebhook(sessionId);

  if (verificationResult.status === 'PENDING_MANUAL_REVIEW') {
    await performManualReview(sessionId);
  }

  return `Verification for user ${userId} completed with status: ${verificationResult.status}`;
}

This snippet illustrates how Temporal orchestrates the flow, with Didit handling the actual identity checks. The initiateDiditSession and waitForDiditWebhook would be Temporal activities wrapping Didit API calls and webhook listener logic. The performManualReview activity could trigger an internal tool for your support team, and Temporal would wait for its completion, ensuring the entire process is robust and traceable.

How Didit Helps

Didit is the AI-native, developer-first identity platform that provides the powerful building blocks for orchestrating adaptive friction workflows. Our modular architecture allows you to plug-and-play identity checks like ID Verification (OCR, MRZ, barcodes), Passive & Active Liveness, 1:1 Face Match & Face Search, and AML Screening & Monitoring into your Temporal workflows with ease. Didit's no-code Business Console enables you to design comprehensive workflows, combining various features and defining thresholds, without writing a single line of code. These pre-configured workflows can then be triggered via our clean APIs, simplifying integration.

Didit's advantages include Core KYC, a flexible pay-per-successful-check model, and no setup fees, making it accessible for businesses of all sizes. Our AI-native approach ensures high accuracy and fraud detection capabilities, while our global design supports verification across numerous countries and document types. By leveraging Didit, you can focus on your core business logic within Temporal, confident that the underlying identity verification is handled by a leading, robust platform.

Ready to Get Started?

Ready to see Didit in action? Get a free demo today.

Start verifying identities for free with Didit's free tier.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Blog questions

Who writes the Didit blog?
The Didit team. Guides reviewed by Alberto Rosas, co-founder and CEO, carry his byline. The rest are published as Didit.
Which topics does the blog cover?
Eight topics: ID verification, business verification (KYB), AML, sanctions and compliance, fraud prevention, transaction monitoring and crypto, country guides, agents and developers, and product updates.
Is the blog available in my language?
Yes, in 15 languages: English, Spanish, French, German, Brazilian and European Portuguese, Catalan, Russian, Arabic, Chinese, Japanese, Hindi, Indonesian, Korean and Swahili. Not every post is translated, so each language shows the posts it has.
Where do I find product updates?
In the changelog at /changelog/ and under the Product updates topic.
Are these posts legal advice?
No. Regulation posts explain rules; your legal team decides how they apply.
How do I find posts on one topic?
Open one of the eight topics, or search the blog.
Are posts dated?
Yes. Every post shows when it was published and when it was last updated.
Do posts link to the docs?
Developer posts link to the matching page on docs.didit.me and to the API reference.
Is the blog the same as the docs?
No. The blog explains rules, markets and product changes for a general reader, while docs.didit.me holds the integration guides and the API reference. Developer posts link the matching docs page and the API reference they describe.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.