Skip to main content

Subscribe to Events

POST /agent/memory/subscribe

Register a webhook URL to receive real-time notifications when events occur in a volume.

Request

Body:

FieldTypeRequiredDescription
volume_idstring (UUID)YesVolume to watch
urlstring (URL)YesWebhook endpoint (max 2048 chars)
eventsstring[]NoEvent types to subscribe to (default: ["memory.approved", "memory.flagged"])
secretstringNoShared secret for HMAC signature verification (max 256 chars)

Response

{
"webhook_id": "a1b2c3d4-...",
"status": "subscribed",
"events": ["memory.approved", "memory.flagged"]
}

Webhook Payload

When an event occurs, SharedMemory sends a POST request to your URL:

{
"event": "memory.approved",
"volume_id": "...",
"data": {
"memory_id": "...",
"content": "John is the CTO",
"agent": "sdk-agent",
"confidence": 0.92
},
"timestamp": "2024-01-15T10:30:00Z"
}

Unsubscribe

DELETE /agent/memory/unsubscribe

{
"volume_id": "...",
"url": "https://your-webhook.com/callback"
}

Available Events

EventDescription
memory.approvedA memory passed the guard and was stored
memory.rejectedA memory was rejected by the guard
memory.flaggedA memory was flagged for review
memory.mergedA memory was merged with an existing one
entity.createdA new entity appeared in the graph
entity.updatedAn entity's facts or summary changed
document.processedA document finished ingestion