Skip to main content
Metadata
FieldValue
Canonical URIhttps://docs.aion.to/extensions/aion/event/1.0.0
Issueraion
Version1.0.0
ActivationThis extension will automatically activate if detected in request regardless of explicit activation.
Related ExtensionsDistribution

Overview

The Event extension provides a generic container for other extensions to transmit events. The scope of an event is the entire Message, and it is not intended that multiple events be combined into the same Message. An event’s payload is typically represented by a DataPart in a Message object, but the entire contents of the Message are considered to be part of the event. This extension only defines how to designate a Message as an event; another extension which requires the use of events will provide payload schemas.

Message Metadata

Event metadata follows the CloudEvents specification. This metadata describes the event itself (identity, source, and type), not the shape of the payload. In practice, this metadata lives on the message.metadata object inside the SendMessageRequest params.
NameRequiredDescription
typerequiredReverse-DNS, dot-separated event name with optional version suffix.
sourcerequiredNon-empty URI-reference for the event context (logical origin).
idrequiredProducer-specified id for idempotency; unique within the source.
Notes:
  • Example type: to.aion.{event-name}.1.0.0.
  • Prefer an absolute URI for source when possible.
  • Producers MUST ensure source + id uniquely identify each event; retries may resend the same pair and consumers may treat identical pairs as duplicates.

Part Metadata

Event payload data may be contained within Message Parts, usually a DataPart. Part metadata defines the schema for the event payload. The schema URI can point to a separate extension or an external specification that defines the payload structure.
NameRequiredDescription
schemaoptionalSchema URI that defines the event payload shape; format as a URI-reference.

Example

{
  "jsonrpc": "2.0",
  "method": "message/send",
  "id": 123,
  "params": {
    "message": {
      "kind": "message",
      "role": "user",
      "parts": [
        {
          "kind": "text",
          "text": "What's the weather like in Reno today?"
        },
        {
          "kind": "file",
          "file": {
            "name": "document.pdf",
            "mimeType": "application/pdf",
            "uri": "http://images.google.com/dfad321"
            }
        },
        {
          "kind": "data",
          "data": {
            "network": "Telegram",
            "userId": "3jkjdacmm31aeee4",
            "messageId": "bbb7dee1-cf5c-4683-8a6f-4114529da5eb",
            "contextId": "bbb7dee1-cf5c-4683-8a6f-4114529da5eb",
            "parentContextId": "bbb7dee1-cf5c-4683-8a6f-4114529da5eb",
            "trajectory": "direct-message"
          },
          "metadata": {
            "https://docs.aion.to/extensions/aion/event/1.0.0": {
	            "schema": "https://docs.aion.to/extensions/aion/distribution/1.0.0#InboundMessageInfo"
            }
          }
        }
      ],
      "messageId": "bbb7dee1-cf5c-4683-8a6f-4114529da5eb",
      "extensions": ["https://docs.aion.to/extensions/aion/distribution/1.0.0", "https://docs.aion.to/extensions/aion/event/1.0.0"],
      "metadata": {
        "https://docs.aion.to/extensions/aion/event/1.0.0": {
          "type": "to.aion.messages.inbound",
          "source": "aion://distributions/bdee1-cf5c-4683-8a6f-29da5eb",
          "id": "6xzza-dfae"
        } // event extension metadata
      } // message.metadata
    } // params.message
  } // params
} // JSON-RPC request