Sending Attachments via the Inbound Webhook

The inbound web-hook accepts your JSON payload plus an optional top-level _attachments array. Everything else in the body is delivered to the AOP as trigger data; each _attachments entry becomes a standard attachment the AOP can access and parse (e.g., with the Document Parsing tool).

Two ways to send a file

Each _attachments entry must contain either a url or a data_b64 field, plus filename and mime.

Option A — URL reference

Use when the file is already hosted somewhere Leena's servers can reach.

{
  "ticket_number": "INC0012345",
  "short_description": "Printer not working",
  "_attachments": [
    {
      "url": "https://files.example.com/error-screenshot.jpg",
      "filename": "error-screenshot.jpg",
      "mime": "image/jpeg"
    }
  ]
}
  • The URL is passed through as-is and fetched only when the AOP's parsing step runs — it must be accessible without an interactive login at that time (public or pre-signed link).
  • Links that require an authenticated session (e.g., raw ServiceNow attachment URLs) will fail at parse time — use Option B instead.

Option B — Inline base64 (recommended for ServiceNow and other closed systems)

{
  "ticket_number": "INC0012345",
  "short_description": "Printer not working",
  "_attachments": [
    {
      "data_b64": "<base64-encoded file content>",
      "filename": "error-screenshot.jpg",
      "mime": "image/jpeg"
    }
  ]
}
  • Leena decodes the content, stores it in Leena AI's secure file storage, and provides the AOP a short-lived internal URL. Nothing on your side needs to be publicly exposed.

Limits

LimitDefault
Entries per _attachments array10
Size per inline (base64) attachment, decoded5 MB
Total request body8 MB (base64 inflates content ~34%, so one 5 MB file ≈ 6.7 MB encoded)

Supported file types for parsing

The Document Parsing skill routes by the filename extension, so it must match the real file type:

  • Images: .png, .jpg, .jpeg, .gif (auto-converted/compressed to JPEG internally)
  • Documents: .pdf (up to 200 MB via URL), .docx / .doc (up to 3 MB)

Other formats (WEBP, BMP, TIFF, HEIC, etc.) are rejected at parse time with an "Unsupported document format" error.

Error behavior

ConditionResponseAOP runs?
Body over 8 MB413 Payload Too LargeNo
More than 10 attachments, attachment over 5 MB, invalid base64, or entry missing both url and data_b64400 Bad RequestNo — rejection reason is recorded in the web-hook's Run History
Invalid/missing bearer token401 UnauthorizedNo
Unknown or disabled web-hook404 Not FoundNo
URL attachment unreachable / unsupported format at parse time200 (web-hook accepted)Yes — the parsing step returns an error to the agent, so the AOP should include an error-handling branch

Using web-hook attachments in an AOP

When the web-hook fires, the AOP receives two things separately:

  • Trigger data — your JSON body (with _attachments stripped out), available to reference in instructions (e.g., ticket number, description).
  • Attachments — each entry surfaced to the agent as Name / Type / URL, ready to be passed to skills. Base64 uploads appear as Leena-hosted URLs; URL entries appear as-is.

To read an attachment's content, the AOP (or its AI Colleague) must have the Document Parsing skill enabled. It takes two inputs — the attachment URL and a natural-language query — and parses + answers in a single step.

Sample AOP instructions

## Step 1 "check_attachments": Check for attached images
If the trigger includes one or more image attachments (JPEG/PNG), run Step 2
for each image. If there are no attachments, skip to Step 3.

## Step 2 "parse_image": Extract details from the image
Use the Document Parsing skill:
- document: the attachment URL exactly as provided
- query: "Extract all visible text, error messages, codes, dates and any
  equipment/asset identifiers from this image. Note any illegible parts."
If parsing fails (unsupported format or file too large), do not retry more
than once; record the failure reason and continue to Step 3.

## Step 3 "summarize": Combine and act
Combine the ticket fields from the trigger data with the extracted image
content, then continue the workflow (e.g., post a work note, categorize,
or escalate).

Authoring tips

  • Be specific in the parsing query — name the exact fields to extract. A vague query returns a vague summary.
  • Use the attachment URL exactly as provided; don't ask the agent to rewrite or shorten it.
  • Always add a failure branch (as in Step 2): parse errors are returned to the agent rather than stopping the run, so tell it what to do when a file can't be read.
  • If multiple attachments may arrive, say explicitly whether to process each one or only the first.

Quick checklist

  1. Put ticket/business fields at the top level of the JSON; files go in _attachments.
  2. Prefer base64 for files from systems that require login; keep each file ≤ 5 MB.
  3. Set filename with the correct extension and an accurate mime.
  4. Handle the 400/413 responses on your side (the run won't start); check Run History for the reason.

Did this page help you?