DocuTray

Webhook Types

Type definitions for Webhooks in the DocuTray Node.js SDK — event types and the conversion, identification and step webhook payloads.

WebhookEventType

Webhook event types, sent in the X-Docutray-Event header.

type WebhookEventType =
  | 'CONVERSION_STARTED' | 'CONVERSION_COMPLETED' | 'CONVERSION_FAILED'
  | 'IDENTIFICATION_STARTED' | 'IDENTIFICATION_COMPLETED' | 'IDENTIFICATION_FAILED'
  | 'STEP_STARTED' | 'STEP_COMPLETED' | 'STEP_FAILED';

Webhooks are configured per organization in DocuTray, not per request. Every payload echoes the documentMetadata sent with the request.

ConversionWebhookPayload

Body of a conversion webhook (CONVERSION_STARTED, CONVERSION_COMPLETED, CONVERSION_FAILED). validation is present only on CONVERSION_COMPLETED; see ConversionValidation.

Prop

Type

import type { ConversionWebhookPayload } from 'docutray';

const payload = (await request.json()) as ConversionWebhookPayload;
if (request.headers.get('x-docutray-event') === 'CONVERSION_COMPLETED') {
  console.log(payload.validation);
}

IdentificationWebhookPayload

Body of an identification webhook (IDENTIFICATION_STARTED, IDENTIFICATION_COMPLETED, IDENTIFICATION_FAILED).

Prop

Type

StepWebhookPayload

Body of a step webhook (STEP_STARTED, STEP_COMPLETED, STEP_FAILED).

Prop

Type

On this page