Test Webhook Endpoint
client.Webhooks.Test(ctx, webhookEndpointID, body) (*WebhookEndpointTestResult, error)
POST/webhook_endpoints/{webhook_endpoint_id}/test
Sends a sample event to a webhook endpoint for the authenticated project.
Test Webhook Endpoint
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
"github.com/openai/openai-go/webhooks"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
webhookEndpointTestResult, err := client.Webhooks.Test(
context.TODO(),
"whe_123",
webhooks.WebhookTestParams{
EventType: webhooks.WebhookTestParamsEventTypeBatchCompleted,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", webhookEndpointTestResult.WebhookEndpointID)
}
{
"event_type": "event_type",
"object": "webhook_endpoint.test",
"status_code": 0,
"success": true,
"webhook_endpoint_id": "webhook_endpoint_id"
}Returns Examples
{
"event_type": "event_type",
"object": "webhook_endpoint.test",
"status_code": 0,
"success": true,
"webhook_endpoint_id": "webhook_endpoint_id"
}