Create Webhook Endpoint
client.Webhooks.New(ctx, body) (*WebhookEndpointWithSecret, error)
POST/webhook_endpoints
Create 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"),
)
webhookEndpointWithSecret, err := client.Webhooks.New(context.TODO(), webhooks.WebhookNewParams{
EventTypes: []string{"batch.completed"},
Name: "x",
URL: "https://",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", webhookEndpointWithSecret.ID)
}
{
"id": "id",
"created_at": 0,
"event_types": [
"string"
],
"name": "name",
"object": "webhook_endpoint",
"signing_secret": "signing_secret",
"signing_secret_hint": "signing_secret_hint",
"url": "url",
"updated_at": 0
}Returns Examples
{
"id": "id",
"created_at": 0,
"event_types": [
"string"
],
"name": "name",
"object": "webhook_endpoint",
"signing_secret": "signing_secret",
"signing_secret_hint": "signing_secret_hint",
"url": "url",
"updated_at": 0
}