Skip to content

Send a message ​

Delivers one customer message into the pipeline, with its attachments in the same request.

POST {receiver}/web-chat/message
Authorization: Basic base64(client_id:client_secret)

This goes to the receiver, not the API

The host is the messages_webhook value shown on the channel in the Genudo Console — not {api}.

Returns as soon as the message is queued. The AI reply arrives asynchronously on your callback URL, not in this response.

Text fields plus the binary files, in one request:

bash
curl -X POST "https://receiver.genudo.ai/web-chat/message" \
  -u "wc_YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -F "contact_id=user-abc-123" \
  -F "message=Here are the files you asked for" \
  -F "files=@./photo.png" \
  -F "files=@./invoice.pdf"
js
const form = new FormData()
form.append('contact_id', 'user-abc-123')
form.append('message', 'Here are the files you asked for')
form.append('files', new Blob([fs.readFileSync('./photo.png')]), 'photo.png')

await fetch('https://receiver.genudo.ai/web-chat/message', {
  method: 'POST',
  headers: {
    Authorization: 'Basic ' + Buffer.from(`${clientId}:${clientSecret}`).toString('base64'),
    // Do NOT set Content-Type — fetch sets the multipart boundary for you.
  },
  body: form,
})

application/json ​

Text-only messages, structured output schemas, or files you already pushed to files_upload_url:

bash
curl -X POST "https://receiver.genudo.ai/web-chat/message" \
  -u "wc_YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "contact_id": "user-abc-123",
    "message": "Do you ship to Cairo?",
    "schemas": [
      {
        "type": "json",
        "usage_instructions": "Return shipping availability and estimated delivery days as JSON.",
        "usage_condition": "Only when the customer asks about shipping or delivery.",
        "example": "{\"available\": true, \"estimated_days\": 3}"
      }
    ]
  }'

Request fields ​

FieldTypeRules
contact_idstringRequired, max 255 — the same value on every message in a conversation
messagestringRequired. May be "" when sending attachments only.
filesfile[]multipart only. Field name files or files[]. Max 10 files, 5 MB each.
attachmentsobject[]Optional — { type, url, name? } for files already hosted at a public URL. In multipart, send as a JSON string.
schemasobject[]Optional, max 4 — { type, usage_instructions, usage_condition, example? } structured output schemas for the AI to fill and return as files. In multipart, send as a JSON string.

Requesting structured outputs (schemas) ​

You can pass an optional schemas array on any inbound message when you want the AI to generate structured deliverables alongside its conversational reply:

json
{
  "schemas": [
    {
      "type": "json",
      "usage_instructions": "Return the quoted items and total price.",
      "usage_condition": "Only when the customer asks for a quote.",
      "example": "{\"items\": [{\"name\": \"Widget\", \"qty\": 2}], \"total\": 100}"
    },
    {
      "type": "md",
      "usage_instructions": "Summarise the conversation as a short markdown report.",
      "usage_condition": "When the customer confirms the order."
    }
  ]
}
Schema fieldTypeRules
type"json" | "html" | "md"Required. Format of the generated file (.json, .html, or .md).
usage_instructionsstringRequired, non-empty, max 2,000 characters. How the AI should fill this schema.
usage_conditionstringRequired, non-empty, max 500 characters. When the AI should produce this schema (e.g. "only when the customer asks for a quote").
examplestringRequired when type is json — a string holding a JSON object that follows the example rules below. Optional free text for html and md. Max 8,000 characters for every type.

You can send at most 4 schemas per message.

JSON example rules ​

For type: "json", the AI returns an object with exactly the keys of your example, so the example has to describe every field with a real sample value:

  • The top level must be a JSON object — not an array, string, number or boolean.
  • No null values anywhere — give every field a sample value.
  • No empty arrays — every array needs one sample item, so the AI knows its shape.
  • At most 5 levels of nesting. The top-level object is level 1, and every nested object or array adds a level.
  • At most 40 keys in any single object.
  • At most 8,000 characters in total.
jsonc
// ✅ valid
"{\"customer\": {\"name\": \"Sara\"}, \"items\": [{\"name\": \"Widget\", \"qty\": 2}], \"total\": 100}"

// ❌ rejected
"[{\"name\": \"Widget\"}]"            // top level is an array
"{\"total\": null}"                   // null value
"{\"items\": []}"                     // empty array
"{'total': 100}"                      // single quotes are not JSON

In the reply, a field the AI has no data for comes back as null.

Validation

A schema that breaks any rule above rejects the whole request with 400, and the error message names the rule and where it failed, e.g. schemas.0.example must not contain null values (at example.items[0].name).

How schemas are processed and returned ​

  1. Transient on inbound: Neither the receiver nor the console saves the inbound schemas definitions in the database; they are forwarded directly to the AI agent for that turn.
  2. Saved as S3 files on reply: When the AI agent fills your schemas, Genudo uploads each generated output to S3 and saves its metadata in the assistant reply message's files array:
    • type: "json" → saved as .json (mimetype: "application/json", type: "document")
    • type: "html" → saved as .html (mimetype: "text/html", type: "file")
    • type: "md" → saved as .md (mimetype: "text/markdown", type: "file")
  3. Delivered in Webhook and WebSocket: The generated files are included in files[] (with a temporary signed full_path URL valid for 10 minutes) on both:

No contact identity here

This endpoint does not accept name, email or phone. Set those once with Initiate. Unknown fields are silently stripped rather than rejected, so sending them here fails quietly.

Any file part under another field name is ignored rather than rejected.

Response ​

json
{
  "status": true,
  "message": "Message received",
  "data": { "message_id": "6a9d596d9b739b3683fbe126" }
}

Different envelope

This is the receiver's own shape — it does not use the console's {status, code, validation, message, data} envelope.

message_id is the Mongo id of the stored inbound message. The reply's callback carries its own, different message_id.

What gets stored ​

Both content types produce identical files[] entries on the message:

json
"files": [
  {
    "path": "uploads/wc_YOUR_CLIENT_ID/01M1VAAK85ZQ61JNJQHMC7WKYF.png",
    "mimetype": "image/png",
    "type": "image",
    "size": 46,
    "name": "photo.png"
  }
]

type is derived from the MIME type: image, video, audio, document, or file. Files are stored privately under your own uploads/{client_id}/ prefix.

Errors ​

CodeCause
400Validation error, or Invalid file path on a JSON files[].path outside uploads/{client_id}/
401Invalid client credentials — bad Basic auth, or the connector is inactive
403Origin not allowed / IP not allowed — adjust the allowlists on the channel in the Console
413File too large — a part exceeded 5 MB