Docs: update webhook (#2238)
This commit is contained in:
@@ -18,6 +18,10 @@ Create a new webhook for your project. The webhook will only receive events from
|
|||||||
<CodeGroup>
|
<CodeGroup>
|
||||||
|
|
||||||
```python Python
|
```python Python
|
||||||
|
from mem0 import MemoryClient
|
||||||
|
|
||||||
|
client = MemoryClient(api_key="your-api-key")
|
||||||
|
|
||||||
# Create webhook in a specific project
|
# Create webhook in a specific project
|
||||||
webhook = client.create_webhook(
|
webhook = client.create_webhook(
|
||||||
url="https://your-app.com/webhook",
|
url="https://your-app.com/webhook",
|
||||||
@@ -29,6 +33,9 @@ print(webhook)
|
|||||||
```
|
```
|
||||||
|
|
||||||
```javascript JavaScript
|
```javascript JavaScript
|
||||||
|
const { MemoryClient } = require('mem0ai');
|
||||||
|
const client = new MemoryClient('your-api-key');
|
||||||
|
|
||||||
// Create webhook in a specific project
|
// Create webhook in a specific project
|
||||||
const webhook = await client.createWebhook({
|
const webhook = await client.createWebhook({
|
||||||
url: "https://your-app.com/webhook",
|
url: "https://your-app.com/webhook",
|
||||||
@@ -41,14 +48,14 @@ console.log(webhook);
|
|||||||
|
|
||||||
```json Output
|
```json Output
|
||||||
{
|
{
|
||||||
'webhook_id': "wh_123",
|
"webhook_id": "wh_123",
|
||||||
'name': 'Memory Logger',
|
"name": "Memory Logger",
|
||||||
'url': 'https://your-app.com/webhook',
|
"url": "https://your-app.com/webhook",
|
||||||
'event_types': ['memory_add'],
|
"event_types": ["memory_add"],
|
||||||
'project': 'default-project',
|
"project": "default-project",
|
||||||
'is_active': True,
|
"is_active": true,
|
||||||
'created_at': '2025-02-18T22:59:56.804993-08:00',
|
"created_at": "2025-02-18T22:59:56.804993-08:00",
|
||||||
'updated_at': '2025-02-18T23:06:41.479361-08:00'
|
"updated_at": "2025-02-18T23:06:41.479361-08:00"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -61,19 +68,12 @@ Retrieve all webhooks configured for your project:
|
|||||||
<CodeGroup>
|
<CodeGroup>
|
||||||
|
|
||||||
```python Python
|
```python Python
|
||||||
from mem0 import MemoryClient
|
|
||||||
|
|
||||||
client = MemoryClient(api_key="your-api-key")
|
|
||||||
|
|
||||||
# Get webhooks for a specific project
|
# Get webhooks for a specific project
|
||||||
webhooks = client.get_webhooks(project_id="proj_123")
|
webhooks = client.get_webhooks(project_id="proj_123")
|
||||||
print(webhooks)
|
print(webhooks)
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript JavaScript
|
```javascript JavaScript
|
||||||
const { MemoryClient } = require('mem0ai');
|
|
||||||
const client = new MemoryClient('your-api-key');
|
|
||||||
|
|
||||||
// Get webhooks for a specific project
|
// Get webhooks for a specific project
|
||||||
const webhooks = await client.getWebhooks({projectId: "proj_123"});
|
const webhooks = await client.getWebhooks({projectId: "proj_123"});
|
||||||
console.log(webhooks);
|
console.log(webhooks);
|
||||||
@@ -82,15 +82,15 @@ console.log(webhooks);
|
|||||||
```json Output
|
```json Output
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
'webhook_id': "wh_123",
|
"webhook_id": "wh_123",
|
||||||
'url': 'https://mem0.ai',
|
"url": "https://mem0.ai",
|
||||||
'name': 'mem0',
|
"name": "mem0",
|
||||||
'owner': 'john',
|
"owner": "john",
|
||||||
'event_types': ['memory_add'],
|
"event_types": ["memory_add"],
|
||||||
'project': 'default-project',
|
"project": "default-project",
|
||||||
'is_active': True,
|
"is_active": true,
|
||||||
'created_at': '2025-02-18T22:59:56.804993-08:00',
|
"created_at": "2025-02-18T22:59:56.804993-08:00",
|
||||||
'updated_at': '2025-02-18T23:06:41.479361-08:00'
|
"updated_at": "2025-02-18T23:06:41.479361-08:00"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -121,9 +121,9 @@ print(updated_webhook)
|
|||||||
const updatedWebhook = await client.updateWebhook({
|
const updatedWebhook = await client.updateWebhook({
|
||||||
name: "Updated Logger",
|
name: "Updated Logger",
|
||||||
url: "https://your-app.com/new-webhook",
|
url: "https://your-app.com/new-webhook",
|
||||||
|
eventTypes: ["memory:update", "memory:add"],
|
||||||
projectId: "proj_123",
|
projectId: "proj_123",
|
||||||
webhookId: "wh_123",
|
webhookId: "wh_123"
|
||||||
eventTypes: ["memory:update", "memory:add"]
|
|
||||||
});
|
});
|
||||||
console.log(updatedWebhook);
|
console.log(updatedWebhook);
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user