Skip to content

Webhook Payload Reference

When an event triggers a webhook, MAIA sends an HTTP POST request with a JSON payload containing all relevant information about the message.

Payload Structure

json
{
  "channelId": "550e8400-e29b-41d4-a716-446655440000",
  "channelIdentifier": "+5511999999999",
  "agentId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "sessionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "messageId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
  "response": "Hello! How can I assist you today?",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "attachments": [
    {
      "id": "attachment-uuid",
      "url": "https://presigned-url.example.com/file.pdf",
      "type": "document",
      "size": 102400,
      "mimeType": "application/pdf"
    }
  ]
}

Field Reference

FieldTypeDescription
channelIdstringInternal UUID of the channel
channelIdentifierstringExternal identifier (e.g., WhatsApp phone number +5511999999999, username, etc.)
agentIdstringUUID of the AI agent that processed the message
sessionIdstringUUID of the conversation session
messageIdstringUnique UUID of this message
responsestringThe message content/text
timestampstringISO 8601 formatted timestamp
attachmentsarrayOptional array of file attachments

Attachments

When a message includes files, the attachments array contains objects with:

FieldTypeDescription
idstringUnique attachment identifier
urlstringPre-signed URL to download the file (expires after a set period)
typestringAttachment type: image, audio, video, or document
sizenumberFile size in bytes
mimeTypestringMIME type (e.g., application/pdf, image/png)

Pre-signed URLs

Attachment URLs are pre-signed and will expire. Download or process attachments promptly after receiving the webhook.

Example Payloads

Text-only Message

json
{
  "channelId": "550e8400-e29b-41d4-a716-446655440000",
  "channelIdentifier": "+5511999999999",
  "agentId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "sessionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "messageId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
  "response": "Your order #12345 has been shipped and will arrive in 2-3 business days.",
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Message with Image Attachment

json
{
  "channelId": "550e8400-e29b-41d4-a716-446655440000",
  "channelIdentifier": "support-bot",
  "agentId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "sessionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "messageId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
  "response": "Here's the product image you requested:",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "attachments": [
    {
      "id": "img-001",
      "url": "https://storage.maiacompany.io/files/product.jpg?signature=xyz",
      "type": "image",
      "size": 245760,
      "mimeType": "image/jpeg"
    }
  ]
}

Message with Audio (Voice Note)

json
{
  "channelId": "550e8400-e29b-41d4-a716-446655440000",
  "channelIdentifier": "+5511888888888",
  "agentId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "sessionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "messageId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
  "response": "",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "attachments": [
    {
      "id": "audio-001",
      "url": "https://storage.maiacompany.io/files/voice.ogg?signature=abc",
      "type": "audio",
      "size": 51200,
      "mimeType": "audio/ogg"
    }
  ]
}

HTTP Headers

Each webhook request includes the following headers:

HeaderValue
Content-Typeapplication/json
User-AgentMaia-Webhook/1.0
X-Maia-SignatureHMAC-SHA256 signature (see Security)

Next Steps

  • Security - Learn how to verify webhook signatures

MAIA Platform Documentation