Create a new webhook configuration
client.ZeroTrust.Casb.Posture.Webhooks.New(ctx, params) (*CasbPostureWebhookNewResponse, error)
POST/accounts/{account_id}/data-security/posture/webhooks
Creates a new webhook configuration for sending finding notifications to external endpoints.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
Accepted Permissions (at least one required)
Create a new webhook configuration
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/zero_trust"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
webhook, err := client.ZeroTrust.Casb.Posture.Webhooks.New(context.TODO(), zero_trust.CasbPostureWebhookNewParams{
AccountID: cloudflare.F("46148281d8a93d002ef242d8b0d5f9f6"),
AuthenticationType: cloudflare.F(zero_trust.CasbPostureWebhookNewParamsAuthenticationTypeBearerAuth),
DestinationURL: cloudflare.F("https://example.com/webhook"),
Label: cloudflare.F("Send to Slack"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", webhook.ID)
}
{
"errors": [
{
"code": 1000,
"message": "Request processed successfully",
"documentation_url": "https://developers.cloudflare.com/api/operations/list-findings",
"source": {
"pointer": "/data/attributes/name"
}
}
],
"messages": [
{
"code": 1000,
"message": "Request processed successfully",
"documentation_url": "https://developers.cloudflare.com/api/operations/list-findings",
"source": {
"pointer": "/data/attributes/name"
}
}
],
"success": true,
"result": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"authentication_type": "Bearer Auth",
"created_at": "2024-01-15T10:30:00Z",
"destination_url": "https://example.com/webhook",
"label": "Send to Gmail",
"status": "enabled",
"updated_at": "2024-01-20T14:45:00Z",
"version": 1,
"headers": [
{
"key": "authorization"
}
]
}
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "Request processed successfully",
"documentation_url": "https://developers.cloudflare.com/api/operations/list-findings",
"source": {
"pointer": "/data/attributes/name"
}
}
],
"messages": [
{
"code": 1000,
"message": "Request processed successfully",
"documentation_url": "https://developers.cloudflare.com/api/operations/list-findings",
"source": {
"pointer": "/data/attributes/name"
}
}
],
"success": true,
"result": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"authentication_type": "Bearer Auth",
"created_at": "2024-01-15T10:30:00Z",
"destination_url": "https://example.com/webhook",
"label": "Send to Gmail",
"status": "enabled",
"updated_at": "2024-01-20T14:45:00Z",
"version": 1,
"headers": [
{
"key": "authorization"
}
]
}
}