Integration
Tutorial
April 13, 2026
Real-Time Memory Events with Webhooks
REM Labs webhooks notify your application in real time when memories are created, updated, or deleted. Build reactive systems that respond to knowledge changes -- sync memories to your database, trigger workflows when new context arrives, or keep a dashboard updated with the latest AI knowledge.
Registering a Webhook
Register a webhook endpoint via the REM Labs API:
curl -X POST https://api.remlabs.ai/v1/webhooks \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.com/webhooks/remlabs",
"events": ["memory.created", "memory.updated", "memory.deleted"],
"namespace": "my-project",
"secret": "your-webhook-secret"
}'
Webhook Event Payload
When an event fires, REM Labs sends a POST request to your URL with this payload:
{
"id": "evt_abc123",
"event": "memory.created",
"timestamp": "2026-04-13T10:30:00Z",
"data": {
"memory_id": "mem_xyz789",
"content": "We decided to use Redis for caching",
"namespace": "my-project",
"tags": ["architecture", "caching"],
"created_at": "2026-04-13T10:30:00Z"
}
}
Verifying Webhook Signatures
Every webhook request includes an X-REM-Signature header. Verify it to ensure the request is authentic:
// Node.js verification
import crypto from "crypto";
function verifyWebhook(body, signature, secret) {
const expected = crypto
.createHmac("sha256", secret)
.update(JSON.stringify(body))
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
// In your Express handler
app.post("/webhooks/remlabs", express.json(), (req, res) => {
const sig = req.headers["x-rem-signature"];
if (!verifyWebhook(req.body, sig, WEBHOOK_SECRET)) {
return res.status(401).send("Invalid signature");
}
const { event, data } = req.body;
switch (event) {
case "memory.created":
console.log("New memory:", data.content);
break;
case "memory.updated":
console.log("Updated:", data.memory_id);
break;
case "memory.deleted":
console.log("Deleted:", data.memory_id);
break;
}
res.sendStatus(200);
});
Use Case: Sync to Your Database
Keep a local copy of your memories synced in real time:
// On memory.created or memory.updated
case "memory.created":
case "memory.updated":
await db.memories.upsert({
where: { remId: data.memory_id },
update: {
content: data.content,
tags: data.tags,
updatedAt: data.created_at
},
create: {
remId: data.memory_id,
content: data.content,
tags: data.tags,
namespace: data.namespace
}
});
break;
case "memory.deleted":
await db.memories.delete({
where: { remId: data.memory_id }
});
break;
Use Case: Slack Notifications
Notify a Slack channel when important memories are created:
case "memory.created":
if (data.tags?.includes("architecture")) {
await fetch(SLACK_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: `New architecture decision stored:\n${data.content}`
})
});
}
break;
Available Events
- memory.created -- a new memory was stored
- memory.updated -- an existing memory was modified
- memory.deleted -- a memory was removed
- memory.recalled -- memories were searched (useful for analytics)
Retry policy: Failed webhook deliveries are retried with exponential backoff up to 3 times. If all retries fail, the event is logged in your console dashboard for manual inspection.
Build reactive memory systems
Free tier. Real-time events. Signed payloads for security.
Get started free →