Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
# Get all webhooks
webhooks = client.get_webhooks(project_id="your_project_id")
print(webhooks)
# Create a webhook
webhook = client.create_webhook(
url="https://your-webhook-url.com",
name="My Webhook",
project_id="your_project_id",
event_types=["memory:add", "memory:categorize"]
)
print(webhook)// To use the JavaScript SDK, install the package:
// npm i mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'your-api-key' });
// Get all webhooks
client.getWebhooks('your_project_id')
.then(webhooks => console.log(webhooks))
.catch(err => console.error(err));
// Create a webhook
client.createWebhook({
url: 'https://your-webhook-url.com',
name: 'My Webhook',
project_id: 'your_project_id',
event_types: ['memory:add']
})
.then(webhook => console.log(webhook))
.catch(err => console.error(err));# Get all webhooks
curl --request GET \
--url 'https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/' \
--header 'Authorization: Token your-api-key'
# Create a webhook
curl --request POST \
--url 'https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/' \
--header 'Authorization: Token your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://your-webhook-url.com",
"name": "My Webhook",
"event_types": ["memory:add"]
}'<?php
$curl = curl_init();
// Get all webhooks
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Token your-api-key"],
]);
$response = curl_exec($curl);
// Create a webhook
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
"url" => "https://your-webhook-url.com",
"name" => "My Webhook",
"event_types" => ["memory:add"]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Token your-api-key",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
// Get all webhooks
req, _ := http.NewRequest("GET", "https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/", nil)
req.Header.Add("Authorization", "Token your-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
// Create a webhook
payload := strings.NewReader(`{
"url": "https://your-webhook-url.com",
"name": "My Webhook",
"event_types": ["memory:add"]
}`)
req, _ = http.NewRequest("POST", "https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/", payload)
req.Header.Add("Authorization", "Token your-api-key")
req.Header.Add("Content-Type", "application/json")
res, _ = http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ = ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}// Get all webhooks
HttpResponse<String> response = Unirest.get("https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/")
.header("Authorization", "Token your-api-key")
.asString();
// Create a webhook
HttpResponse<String> response = Unirest.post("https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/")
.header("Authorization", "Token your-api-key")
.header("Content-Type", "application/json")
.body("{
\"url\": \"https://your-webhook-url.com\",
\"name\": \"My Webhook\",
\"event_types\": [\"memory:add\"]
}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/api/v1/webhooks/projects/{project_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body[
{
"webhook_id": "<string>",
"name": "<string>",
"url": "<string>",
"event_types": [
"<string>"
],
"is_active": true,
"project": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]{
"error": "You don't have access to this project"
}Webhooks
Get Webhook
Retrieve webhook configuration details for a specific project on the Mem0 platform.
GET
/
api
/
v1
/
webhooks
/
projects
/
{project_id}
/
Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
# Get all webhooks
webhooks = client.get_webhooks(project_id="your_project_id")
print(webhooks)
# Create a webhook
webhook = client.create_webhook(
url="https://your-webhook-url.com",
name="My Webhook",
project_id="your_project_id",
event_types=["memory:add", "memory:categorize"]
)
print(webhook)// To use the JavaScript SDK, install the package:
// npm i mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'your-api-key' });
// Get all webhooks
client.getWebhooks('your_project_id')
.then(webhooks => console.log(webhooks))
.catch(err => console.error(err));
// Create a webhook
client.createWebhook({
url: 'https://your-webhook-url.com',
name: 'My Webhook',
project_id: 'your_project_id',
event_types: ['memory:add']
})
.then(webhook => console.log(webhook))
.catch(err => console.error(err));# Get all webhooks
curl --request GET \
--url 'https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/' \
--header 'Authorization: Token your-api-key'
# Create a webhook
curl --request POST \
--url 'https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/' \
--header 'Authorization: Token your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://your-webhook-url.com",
"name": "My Webhook",
"event_types": ["memory:add"]
}'<?php
$curl = curl_init();
// Get all webhooks
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Token your-api-key"],
]);
$response = curl_exec($curl);
// Create a webhook
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
"url" => "https://your-webhook-url.com",
"name" => "My Webhook",
"event_types" => ["memory:add"]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Token your-api-key",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
// Get all webhooks
req, _ := http.NewRequest("GET", "https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/", nil)
req.Header.Add("Authorization", "Token your-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
// Create a webhook
payload := strings.NewReader(`{
"url": "https://your-webhook-url.com",
"name": "My Webhook",
"event_types": ["memory:add"]
}`)
req, _ = http.NewRequest("POST", "https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/", payload)
req.Header.Add("Authorization", "Token your-api-key")
req.Header.Add("Content-Type", "application/json")
res, _ = http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ = ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}// Get all webhooks
HttpResponse<String> response = Unirest.get("https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/")
.header("Authorization", "Token your-api-key")
.asString();
// Create a webhook
HttpResponse<String> response = Unirest.post("https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/")
.header("Authorization", "Token your-api-key")
.header("Content-Type", "application/json")
.body("{
\"url\": \"https://your-webhook-url.com\",
\"name\": \"My Webhook\",
\"event_types\": [\"memory:add\"]
}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/api/v1/webhooks/projects/{project_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body[
{
"webhook_id": "<string>",
"name": "<string>",
"url": "<string>",
"event_types": [
"<string>"
],
"is_active": true,
"project": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]{
"error": "You don't have access to this project"
}Authorizations
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Path Parameters
Unique identifier of the project.
Response
List of webhooks for the project.
Unique identifier of the webhook.
Name of the webhook
URL endpoint for the webhook.
List of event types the webhook subscribes to.
Whether the webhook is active
Name of the project the webhook is associated with
Timestamp when the webhook was created
Timestamp when the webhook was last updated
Was this page helpful?
⌘I