Ocriva Logo

Documents

Discord Integration

Send document processing notifications to Discord channels.

integrationsdiscordmessagingnotifications

Published: 4/5/2026

Discord Integration

Ocriva can post document processing notifications directly to a Discord channel using Discord's built-in Incoming Webhooks. When a document is processed, fails, or a batch completes, Ocriva sends a rich embed message to the channel you choose — no bots, no OAuth flow, no third-party middleware required.

NOTE

This integration uses Discord's native webhook feature. You do not need a verified Discord application or a bot token. Any server member with the Manage Webhooks permission can set it up in under two minutes.


Prerequisites

Before you begin, confirm you have:

  • A Discord server where you have the Manage Webhooks permission (or are the server owner)
  • An Ocriva account with access to the Integrations section
  • At least one active project and template in Ocriva

Step 1: Create a Discord Webhook

  1. Open Discord and navigate to the server where you want to receive notifications
  2. Right-click the target channel (e.g., #ocriva-alerts) and select Edit Channel
  3. Go to Integrations in the left sidebar
  4. Click Webhooks, then click New Webhook
  5. Give the webhook a descriptive name, for example Ocriva Notifications
  6. Optionally upload an avatar image to identify messages at a glance
  7. Confirm the correct channel is selected in the Channel dropdown
  8. Click Copy Webhook URL — this URL is your delivery endpoint

WARNING

The webhook URL contains a secret token. Treat it like a password. Anyone with the URL can post messages to your channel. Do not commit it to source control or share it in public channels.


Step 2: Configure in Ocriva

  1. In the Ocriva dashboard, navigate to Integrations in the left sidebar
  2. Select the Discord template from the list of available integration templates
  3. Paste the webhook URL you copied from Discord into the Webhook URL field
  4. Under Events, enable the events you want to receive:
    • document.processed — fires when a document is successfully extracted
    • document.failed — fires when extraction fails
    • batch.completed — fires when all documents in a batch finish processing
  5. Review the payload template in the Payload editor (see the next section for details)
  6. Click Save to activate the integration

TIP

Start with only document.failed and batch.completed enabled. This keeps your Discord channel quiet during normal operation and only alerts you when action is needed. You can enable document.processed later if you want a confirmation message for every file.


Payload Template

The default Discord payload uses the embed format to produce a clean, structured notification card in your channel:

{
  "content": "**{{eventType}}** - {{payload.fileName}}",
  "embeds": [
    {
      "title": "{{eventType}}",
      "description": "File: {{payload.fileName}}\nStatus: {{payload.status}}",
      "color": 5814783,
      "timestamp": "{{timestamp}}"
    }
  ]
}

Variable Reference

VariableReplaced with
{{eventType}}The event name, e.g. document.processed
{{payload.fileName}}The original file name of the document
{{payload.status}}The processing status, e.g. completed or failed
{{timestamp}}ISO 8601 UTC timestamp of the event
{{payload.batchId}}Batch identifier (available on batch.completed events)
{{organizationId}}Your organization ID

Embed Color

The default color 5814783 is the decimal representation of #58B9FF — a soft blue that works well in both light and dark Discord themes. To change it, convert your desired hex color to decimal (e.g. #ED424515548997 for Discord's red).

NOTE

Discord requires embed colors as a decimal integer, not a hex string. Use a tool like parseInt("ED4245", 16) in the browser console, or any online hex-to-decimal converter.


Customizing the Payload

You can extend the default template to add more detail to the embed.

Adding Fields to the Embed

Discord embeds support an optional fields array that renders as a two-column grid inside the card:

{
  "content": "**{{eventType}}** - {{payload.fileName}}",
  "embeds": [
    {
      "title": "{{eventType}}",
      "description": "File: {{payload.fileName}}\nStatus: {{payload.status}}",
      "color": 5814783,
      "timestamp": "{{timestamp}}",
      "fields": [
        {
          "name": "Organization",
          "value": "{{organizationId}}",
          "inline": true
        },
        {
          "name": "Processing Time",
          "value": "{{payload.processingTime}}ms",
          "inline": true
        }
      ],
      "footer": {
        "text": "Ocriva · Document Processing"
      }
    }
  ]
}

Changing the Embed Color Per Event

If you want the embed to visually distinguish success from failure, create two separate webhook configurations — one for document.processed (blue, 5814783) and one for document.failed (red, 15548997).


Example: Document Processing Notification

Scenario: A user uploads invoice-2026-03.pdf. Ocriva's AI extracts the data and fires a document.processed event.

The payload Ocriva sends to Discord looks like this:

{
  "content": "**document.processed** - invoice-2026-03.pdf",
  "embeds": [
    {
      "title": "document.processed",
      "description": "File: invoice-2026-03.pdf\nStatus: completed",
      "color": 5814783,
      "timestamp": "2026-04-05T09:15:00.000Z"
    }
  ]
}

Discord renders this as a blue embed card in your channel with the event title, file name, status, and timestamp visible at a glance.

TIP

For batch events, {{payload.fileName}} is empty because batches contain multiple files. Customize the description for batch events to use {{payload.batchId}} and batch-level fields like {{payload.totalFiles}} and {{payload.failedFiles}} instead.


Testing the Integration

After saving your configuration, use the built-in test tool to verify delivery before relying on it in production:

  1. In the Ocriva Integrations panel, open your Discord webhook configuration
  2. Click Send Test Event
  3. Ocriva sends a sample document.processed payload to your Discord webhook URL
  4. Check your Discord channel — the embed card should appear within a few seconds
  5. If no message appears, click View Delivery Log to inspect the HTTP response code and response body returned by Discord

NOTE

A successful delivery returns HTTP 204 No Content from Discord. Any 4xx response indicates a problem with the URL or the payload structure (see Troubleshooting below).


Troubleshooting

No message appears in Discord

  • Confirm the webhook URL is pasted correctly with no extra spaces or line breaks
  • Check the Delivery Log in Ocriva for the HTTP status code
  • Verify the webhook has not been deleted in Discord (Server Settings → Integrations → Webhooks)

HTTP 400 Bad Request

The payload JSON is malformed or contains an invalid value. Common causes:

CauseFix
Embed color is a hex string ("#58B9FF")Change to a decimal integer (5814783)
Missing required embeds arrayEnsure the embeds key is present and is an array
timestamp format is not ISO 8601Use {{timestamp}} — Ocriva always emits ISO 8601

HTTP 404 Not Found

The webhook URL is no longer valid. This happens when the webhook is deleted in Discord. Create a new webhook in Discord, copy the new URL, and update the Ocriva configuration.

HTTP 429 Too Many Requests

Discord rate-limits webhooks to 30 requests per minute per webhook. If you process large batches rapidly, consider:

  • Enabling only batch.completed instead of document.processed to reduce message volume
  • Creating a second webhook in a different channel and splitting event types between them

WARNING

Exceeding Discord's rate limit causes Ocriva to queue and retry deliveries automatically. However, if your webhook is rate-limited for an extended period, older queued events may be dropped. See the Retry & Rate Limiting guide for Ocriva's retry policy details.