Replace a webhook
client.RealtimeKit.Webhooks.ReplaceWebhook(ctx, appID, webhookID, params) (*WebhookReplaceWebhookResponse, error)
PUT/accounts/{account_id}/realtime/kit/{app_id}/webhooks/{webhook_id}
Replace all details for the given webhook ID.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Replace a webhook
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/realtime_kit"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
response, err := client.RealtimeKit.Webhooks.ReplaceWebhook(
context.TODO(),
"14a396e7-ca44-4937-bf1f-050a69118543",
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
realtime_kit.WebhookReplaceWebhookParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Events: cloudflare.F([]realtime_kit.WebhookReplaceWebhookParamsEvent{realtime_kit.WebhookReplaceWebhookParamsEventMeetingStarted}),
Name: cloudflare.F("My Webhook"),
URL: cloudflare.F("https://example.com/webhook"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
{
"data": {
"created_at": "2023-07-15T07:08:26.634Z",
"enabled": true,
"events": [
"meeting.started"
],
"id": "b6e0fd13-d7f4-4122-9ad5-7994b35d24b8",
"name": "My Webhook",
"updated_at": "2023-07-15T07:08:26.634Z",
"url": "https://example.com/webhook"
},
"success": true
}{
"error": {
"code": 400,
"message": "BAD_REQUEST: \"id\" must be a valid GUID"
},
"success": false
}"{\n message: \"Unauthorized\"\n}\n"Returns Examples
{
"data": {
"created_at": "2023-07-15T07:08:26.634Z",
"enabled": true,
"events": [
"meeting.started"
],
"id": "b6e0fd13-d7f4-4122-9ad5-7994b35d24b8",
"name": "My Webhook",
"updated_at": "2023-07-15T07:08:26.634Z",
"url": "https://example.com/webhook"
},
"success": true
}{
"error": {
"code": 400,
"message": "BAD_REQUEST: \"id\" must be a valid GUID"
},
"success": false
}"{\n message: \"Unauthorized\"\n}\n"