Update a webhook
curl --request PATCH \
--url https://api.attio.com/v2/webhooks/{webhook_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"target_url": "https://example.com/webhook",
"subscriptions": [
{
"event_type": "note.created",
"filter": {
"$or": [
{
"field": "<string>",
"operator": "equals",
"value": "<string>"
}
]
}
}
]
}
}
'import requests
url = "https://api.attio.com/v2/webhooks/{webhook_id}"
payload = { "data": {
"target_url": "https://example.com/webhook",
"subscriptions": [
{
"event_type": "note.created",
"filter": { "$or": [
{
"field": "<string>",
"operator": "equals",
"value": "<string>"
}
] }
}
]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
target_url: 'https://example.com/webhook',
subscriptions: [
{
event_type: 'note.created',
filter: {$or: [{field: '<string>', operator: 'equals', value: '<string>'}]}
}
]
}
})
};
fetch('https://api.attio.com/v2/webhooks/{webhook_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attio.com/v2/webhooks/{webhook_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'target_url' => 'https://example.com/webhook',
'subscriptions' => [
[
'event_type' => 'note.created',
'filter' => [
'$or' => [
[
'field' => '<string>',
'operator' => 'equals',
'value' => '<string>'
]
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.attio.com/v2/webhooks/{webhook_id}"
payload := strings.NewReader("{\n \"data\": {\n \"target_url\": \"https://example.com/webhook\",\n \"subscriptions\": [\n {\n \"event_type\": \"note.created\",\n \"filter\": {\n \"$or\": [\n {\n \"field\": \"<string>\",\n \"operator\": \"equals\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.attio.com/v2/webhooks/{webhook_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"target_url\": \"https://example.com/webhook\",\n \"subscriptions\": [\n {\n \"event_type\": \"note.created\",\n \"filter\": {\n \"$or\": [\n {\n \"field\": \"<string>\",\n \"operator\": \"equals\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attio.com/v2/webhooks/{webhook_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"target_url\": \"https://example.com/webhook\",\n \"subscriptions\": [\n {\n \"event_type\": \"note.created\",\n \"filter\": {\n \"$or\": [\n {\n \"field\": \"<string>\",\n \"operator\": \"equals\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"target_url": "https://example.com/webhook",
"subscriptions": [
{
"event_type": "note.created",
"filter": {
"$or": [
{
"field": "<string>",
"operator": "equals",
"value": "<string>"
}
]
}
}
],
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"webhook_id": "23e42eaf-323a-41da-b5bb-fd67eebda553"
},
"status": "active",
"created_at": "2023-04-27T13:22:49.061281000Z"
}
}{
"status_code": 404,
"type": "invalid_request_error",
"code": "not_found",
"message": "Webhook with ID \"23e42eaf-323a-41da-b5bb-fd67eebda553\" was not found."
}Webhooks
Update a webhook
Update a webhook and associated subscriptions.
Required scopes: webhook:read-write.
PATCH
/
v2
/
webhooks
/
{webhook_id}
Update a webhook
curl --request PATCH \
--url https://api.attio.com/v2/webhooks/{webhook_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"target_url": "https://example.com/webhook",
"subscriptions": [
{
"event_type": "note.created",
"filter": {
"$or": [
{
"field": "<string>",
"operator": "equals",
"value": "<string>"
}
]
}
}
]
}
}
'import requests
url = "https://api.attio.com/v2/webhooks/{webhook_id}"
payload = { "data": {
"target_url": "https://example.com/webhook",
"subscriptions": [
{
"event_type": "note.created",
"filter": { "$or": [
{
"field": "<string>",
"operator": "equals",
"value": "<string>"
}
] }
}
]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
target_url: 'https://example.com/webhook',
subscriptions: [
{
event_type: 'note.created',
filter: {$or: [{field: '<string>', operator: 'equals', value: '<string>'}]}
}
]
}
})
};
fetch('https://api.attio.com/v2/webhooks/{webhook_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attio.com/v2/webhooks/{webhook_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'target_url' => 'https://example.com/webhook',
'subscriptions' => [
[
'event_type' => 'note.created',
'filter' => [
'$or' => [
[
'field' => '<string>',
'operator' => 'equals',
'value' => '<string>'
]
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.attio.com/v2/webhooks/{webhook_id}"
payload := strings.NewReader("{\n \"data\": {\n \"target_url\": \"https://example.com/webhook\",\n \"subscriptions\": [\n {\n \"event_type\": \"note.created\",\n \"filter\": {\n \"$or\": [\n {\n \"field\": \"<string>\",\n \"operator\": \"equals\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.attio.com/v2/webhooks/{webhook_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"target_url\": \"https://example.com/webhook\",\n \"subscriptions\": [\n {\n \"event_type\": \"note.created\",\n \"filter\": {\n \"$or\": [\n {\n \"field\": \"<string>\",\n \"operator\": \"equals\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attio.com/v2/webhooks/{webhook_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"target_url\": \"https://example.com/webhook\",\n \"subscriptions\": [\n {\n \"event_type\": \"note.created\",\n \"filter\": {\n \"$or\": [\n {\n \"field\": \"<string>\",\n \"operator\": \"equals\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"target_url": "https://example.com/webhook",
"subscriptions": [
{
"event_type": "note.created",
"filter": {
"$or": [
{
"field": "<string>",
"operator": "equals",
"value": "<string>"
}
]
}
}
],
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"webhook_id": "23e42eaf-323a-41da-b5bb-fd67eebda553"
},
"status": "active",
"created_at": "2023-04-27T13:22:49.061281000Z"
}
}{
"status_code": 404,
"type": "invalid_request_error",
"code": "not_found",
"message": "Webhook with ID \"23e42eaf-323a-41da-b5bb-fd67eebda553\" was not found."
}Authorizations
This API uses OAuth 2.0 with the authorization code grant flow.
Path Parameters
A UUID which identifies the webhook.
Example:
"23e42eaf-323a-41da-b5bb-fd67eebda553"
Body
application/json
Show child attributes
Show child attributes
Response
Success
Success
Show child attributes
Show child attributes
Was this page helpful?
⌘I