Node.js SDK
import Migma from 'migma';
const migma = new Migma('YOUR_API_KEY');
const { data, error } = await migma.webhooks.update('WEBHOOK_ID', {
active: false
});curl --request PATCH \
--url https://api.migma.ai/v1/webhooks/{webhookId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [
"<string>"
],
"active": true,
"description": "<string>",
"customHeaders": {}
}
'import requests
url = "https://api.migma.ai/v1/webhooks/{webhookId}"
payload = {
"url": "<string>",
"events": ["<string>"],
"active": True,
"description": "<string>",
"customHeaders": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/webhooks/{webhookId}",
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([
'url' => '<string>',
'events' => [
'<string>'
],
'active' => true,
'description' => '<string>',
'customHeaders' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.migma.ai/v1/webhooks/{webhookId}"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"description\": \"<string>\",\n \"customHeaders\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.migma.ai/v1/webhooks/{webhookId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"description\": \"<string>\",\n \"customHeaders\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/webhooks/{webhookId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"description\": \"<string>\",\n \"customHeaders\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"success": true
},
"error": "<string>"
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Update Webhook
Update a webhook configuration. Requires API key with webhook:write.
PATCH
/
v1
/
webhooks
/
{webhookId}
Node.js SDK
import Migma from 'migma';
const migma = new Migma('YOUR_API_KEY');
const { data, error } = await migma.webhooks.update('WEBHOOK_ID', {
active: false
});curl --request PATCH \
--url https://api.migma.ai/v1/webhooks/{webhookId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [
"<string>"
],
"active": true,
"description": "<string>",
"customHeaders": {}
}
'import requests
url = "https://api.migma.ai/v1/webhooks/{webhookId}"
payload = {
"url": "<string>",
"events": ["<string>"],
"active": True,
"description": "<string>",
"customHeaders": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/webhooks/{webhookId}",
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([
'url' => '<string>',
'events' => [
'<string>'
],
'active' => true,
'description' => '<string>',
'customHeaders' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.migma.ai/v1/webhooks/{webhookId}"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"description\": \"<string>\",\n \"customHeaders\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.migma.ai/v1/webhooks/{webhookId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"description\": \"<string>\",\n \"customHeaders\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/webhooks/{webhookId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"description\": \"<string>\",\n \"customHeaders\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"success": true
},
"error": "<string>"
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Authorizations
API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → Developers → API Keys.
Path Parameters
Webhook ID (MongoDB ObjectId)
Pattern:
^[0-9a-fA-F]{24}$Body
application/json
The webhook endpoint URL (must be HTTPS)
Array of event types to subscribe to
Minimum array length:
1Whether the webhook is active
Optional description for the webhook
Optional custom headers to include in webhook requests
Show child attributes
Show child attributes
Was this page helpful?
⌘I