Webhooks
client.Webhooks.Unwrap(ctx) error
**** ``
Validates that the given payload was sent by OpenAI and parses the payload.
Example
package main
import (
"context"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Webhooks.Unwrap(context.TODO())
if err != nil {
panic(err.Error())
}
}
Domain Types
Batch Cancelled Webhook Event
-
type BatchCancelledWebhookEvent struct{…}Sent when a batch API request has been cancelled.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the batch API request was cancelled.
-
Data BatchCancelledWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the batch API request.
-
-
Type BatchCancelledThe type of the event. Always
batch.cancelled.const BatchCancelledBatchCancelled BatchCancelled = "batch.cancelled"
-
Object BatchCancelledWebhookEventObjectThe object of the event. Always
event.const BatchCancelledWebhookEventObjectEvent BatchCancelledWebhookEventObject = "event"
-
Batch Completed Webhook Event
-
type BatchCompletedWebhookEvent struct{…}Sent when a batch API request has been completed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the batch API request was completed.
-
Data BatchCompletedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the batch API request.
-
-
Type BatchCompletedThe type of the event. Always
batch.completed.const BatchCompletedBatchCompleted BatchCompleted = "batch.completed"
-
Object BatchCompletedWebhookEventObjectThe object of the event. Always
event.const BatchCompletedWebhookEventObjectEvent BatchCompletedWebhookEventObject = "event"
-
Batch Expired Webhook Event
-
type BatchExpiredWebhookEvent struct{…}Sent when a batch API request has expired.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the batch API request expired.
-
Data BatchExpiredWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the batch API request.
-
-
Type BatchExpiredThe type of the event. Always
batch.expired.const BatchExpiredBatchExpired BatchExpired = "batch.expired"
-
Object BatchExpiredWebhookEventObjectThe object of the event. Always
event.const BatchExpiredWebhookEventObjectEvent BatchExpiredWebhookEventObject = "event"
-
Batch Failed Webhook Event
-
type BatchFailedWebhookEvent struct{…}Sent when a batch API request has failed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the batch API request failed.
-
Data BatchFailedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the batch API request.
-
-
Type BatchFailedThe type of the event. Always
batch.failed.const BatchFailedBatchFailed BatchFailed = "batch.failed"
-
Object BatchFailedWebhookEventObjectThe object of the event. Always
event.const BatchFailedWebhookEventObjectEvent BatchFailedWebhookEventObject = "event"
-
Eval Run Canceled Webhook Event
-
type EvalRunCanceledWebhookEvent struct{…}Sent when an eval run has been canceled.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the eval run was canceled.
-
Data EvalRunCanceledWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the eval run.
-
-
Type EvalRunCanceledThe type of the event. Always
eval.run.canceled.const EvalRunCanceledEvalRunCanceled EvalRunCanceled = "eval.run.canceled"
-
Object EvalRunCanceledWebhookEventObjectThe object of the event. Always
event.const EvalRunCanceledWebhookEventObjectEvent EvalRunCanceledWebhookEventObject = "event"
-
Eval Run Failed Webhook Event
-
type EvalRunFailedWebhookEvent struct{…}Sent when an eval run has failed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the eval run failed.
-
Data EvalRunFailedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the eval run.
-
-
Type EvalRunFailedThe type of the event. Always
eval.run.failed.const EvalRunFailedEvalRunFailed EvalRunFailed = "eval.run.failed"
-
Object EvalRunFailedWebhookEventObjectThe object of the event. Always
event.const EvalRunFailedWebhookEventObjectEvent EvalRunFailedWebhookEventObject = "event"
-
Eval Run Succeeded Webhook Event
-
type EvalRunSucceededWebhookEvent struct{…}Sent when an eval run has succeeded.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the eval run succeeded.
-
Data EvalRunSucceededWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the eval run.
-
-
Type EvalRunSucceededThe type of the event. Always
eval.run.succeeded.const EvalRunSucceededEvalRunSucceeded EvalRunSucceeded = "eval.run.succeeded"
-
Object EvalRunSucceededWebhookEventObjectThe object of the event. Always
event.const EvalRunSucceededWebhookEventObjectEvent EvalRunSucceededWebhookEventObject = "event"
-
Fine Tuning Job Cancelled Webhook Event
-
type FineTuningJobCancelledWebhookEvent struct{…}Sent when a fine-tuning job has been cancelled.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.
-
Data FineTuningJobCancelledWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the fine-tuning job.
-
-
Type FineTuningJobCancelledThe type of the event. Always
fine_tuning.job.cancelled.const FineTuningJobCancelledFineTuningJobCancelled FineTuningJobCancelled = "fine_tuning.job.cancelled"
-
Object FineTuningJobCancelledWebhookEventObjectThe object of the event. Always
event.const FineTuningJobCancelledWebhookEventObjectEvent FineTuningJobCancelledWebhookEventObject = "event"
-
Fine Tuning Job Failed Webhook Event
-
type FineTuningJobFailedWebhookEvent struct{…}Sent when a fine-tuning job has failed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the fine-tuning job failed.
-
Data FineTuningJobFailedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the fine-tuning job.
-
-
Type FineTuningJobFailedThe type of the event. Always
fine_tuning.job.failed.const FineTuningJobFailedFineTuningJobFailed FineTuningJobFailed = "fine_tuning.job.failed"
-
Object FineTuningJobFailedWebhookEventObjectThe object of the event. Always
event.const FineTuningJobFailedWebhookEventObjectEvent FineTuningJobFailedWebhookEventObject = "event"
-
Fine Tuning Job Succeeded Webhook Event
-
type FineTuningJobSucceededWebhookEvent struct{…}Sent when a fine-tuning job has succeeded.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the fine-tuning job succeeded.
-
Data FineTuningJobSucceededWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the fine-tuning job.
-
-
Type FineTuningJobSucceededThe type of the event. Always
fine_tuning.job.succeeded.const FineTuningJobSucceededFineTuningJobSucceeded FineTuningJobSucceeded = "fine_tuning.job.succeeded"
-
Object FineTuningJobSucceededWebhookEventObjectThe object of the event. Always
event.const FineTuningJobSucceededWebhookEventObjectEvent FineTuningJobSucceededWebhookEventObject = "event"
-
Realtime Call Incoming Webhook Event
-
type RealtimeCallIncomingWebhookEvent struct{…}Sent when Realtime API Receives a incoming SIP call.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response was completed.
-
Data RealtimeCallIncomingWebhookEventDataEvent data payload.
-
CallID stringThe unique ID of this call.
-
SipHeaders []RealtimeCallIncomingWebhookEventDataSipHeaderHeaders from the SIP Invite.
-
Name stringName of the SIP Header.
-
Value stringValue of the SIP Header.
-
-
-
Type RealtimeCallIncomingThe type of the event. Always
realtime.call.incoming.const RealtimeCallIncomingRealtimeCallIncoming RealtimeCallIncoming = "realtime.call.incoming"
-
Object RealtimeCallIncomingWebhookEventObjectThe object of the event. Always
event.const RealtimeCallIncomingWebhookEventObjectEvent RealtimeCallIncomingWebhookEventObject = "event"
-
Response Cancelled Webhook Event
-
type ResponseCancelledWebhookEvent struct{…}Sent when a background response has been cancelled.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response was cancelled.
-
Data ResponseCancelledWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the model response.
-
-
Type ResponseCancelledThe type of the event. Always
response.cancelled.const ResponseCancelledResponseCancelled ResponseCancelled = "response.cancelled"
-
Object ResponseCancelledWebhookEventObjectThe object of the event. Always
event.const ResponseCancelledWebhookEventObjectEvent ResponseCancelledWebhookEventObject = "event"
-
Response Completed Webhook Event
-
type ResponseCompletedWebhookEvent struct{…}Sent when a background response has been completed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response was completed.
-
Data ResponseCompletedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the model response.
-
-
Type ResponseCompletedThe type of the event. Always
response.completed.const ResponseCompletedResponseCompleted ResponseCompleted = "response.completed"
-
Object ResponseCompletedWebhookEventObjectThe object of the event. Always
event.const ResponseCompletedWebhookEventObjectEvent ResponseCompletedWebhookEventObject = "event"
-
Response Failed Webhook Event
-
type ResponseFailedWebhookEvent struct{…}Sent when a background response has failed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response failed.
-
Data ResponseFailedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the model response.
-
-
Type ResponseFailedThe type of the event. Always
response.failed.const ResponseFailedResponseFailed ResponseFailed = "response.failed"
-
Object ResponseFailedWebhookEventObjectThe object of the event. Always
event.const ResponseFailedWebhookEventObjectEvent ResponseFailedWebhookEventObject = "event"
-
Response Incomplete Webhook Event
-
type ResponseIncompleteWebhookEvent struct{…}Sent when a background response has been interrupted.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response was interrupted.
-
Data ResponseIncompleteWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the model response.
-
-
Type ResponseIncompleteThe type of the event. Always
response.incomplete.const ResponseIncompleteResponseIncomplete ResponseIncomplete = "response.incomplete"
-
Object ResponseIncompleteWebhookEventObjectThe object of the event. Always
event.const ResponseIncompleteWebhookEventObjectEvent ResponseIncompleteWebhookEventObject = "event"
-
Unwrap Webhook Event
-
type UnwrapWebhookEventUnion interface{…}Sent when a batch API request has been cancelled.
-
type BatchCancelledWebhookEvent struct{…}Sent when a batch API request has been cancelled.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the batch API request was cancelled.
-
Data BatchCancelledWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the batch API request.
-
-
Type BatchCancelledThe type of the event. Always
batch.cancelled.const BatchCancelledBatchCancelled BatchCancelled = "batch.cancelled"
-
Object BatchCancelledWebhookEventObjectThe object of the event. Always
event.const BatchCancelledWebhookEventObjectEvent BatchCancelledWebhookEventObject = "event"
-
-
type BatchCompletedWebhookEvent struct{…}Sent when a batch API request has been completed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the batch API request was completed.
-
Data BatchCompletedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the batch API request.
-
-
Type BatchCompletedThe type of the event. Always
batch.completed.const BatchCompletedBatchCompleted BatchCompleted = "batch.completed"
-
Object BatchCompletedWebhookEventObjectThe object of the event. Always
event.const BatchCompletedWebhookEventObjectEvent BatchCompletedWebhookEventObject = "event"
-
-
type BatchExpiredWebhookEvent struct{…}Sent when a batch API request has expired.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the batch API request expired.
-
Data BatchExpiredWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the batch API request.
-
-
Type BatchExpiredThe type of the event. Always
batch.expired.const BatchExpiredBatchExpired BatchExpired = "batch.expired"
-
Object BatchExpiredWebhookEventObjectThe object of the event. Always
event.const BatchExpiredWebhookEventObjectEvent BatchExpiredWebhookEventObject = "event"
-
-
type BatchFailedWebhookEvent struct{…}Sent when a batch API request has failed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the batch API request failed.
-
Data BatchFailedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the batch API request.
-
-
Type BatchFailedThe type of the event. Always
batch.failed.const BatchFailedBatchFailed BatchFailed = "batch.failed"
-
Object BatchFailedWebhookEventObjectThe object of the event. Always
event.const BatchFailedWebhookEventObjectEvent BatchFailedWebhookEventObject = "event"
-
-
type EvalRunCanceledWebhookEvent struct{…}Sent when an eval run has been canceled.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the eval run was canceled.
-
Data EvalRunCanceledWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the eval run.
-
-
Type EvalRunCanceledThe type of the event. Always
eval.run.canceled.const EvalRunCanceledEvalRunCanceled EvalRunCanceled = "eval.run.canceled"
-
Object EvalRunCanceledWebhookEventObjectThe object of the event. Always
event.const EvalRunCanceledWebhookEventObjectEvent EvalRunCanceledWebhookEventObject = "event"
-
-
type EvalRunFailedWebhookEvent struct{…}Sent when an eval run has failed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the eval run failed.
-
Data EvalRunFailedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the eval run.
-
-
Type EvalRunFailedThe type of the event. Always
eval.run.failed.const EvalRunFailedEvalRunFailed EvalRunFailed = "eval.run.failed"
-
Object EvalRunFailedWebhookEventObjectThe object of the event. Always
event.const EvalRunFailedWebhookEventObjectEvent EvalRunFailedWebhookEventObject = "event"
-
-
type EvalRunSucceededWebhookEvent struct{…}Sent when an eval run has succeeded.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the eval run succeeded.
-
Data EvalRunSucceededWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the eval run.
-
-
Type EvalRunSucceededThe type of the event. Always
eval.run.succeeded.const EvalRunSucceededEvalRunSucceeded EvalRunSucceeded = "eval.run.succeeded"
-
Object EvalRunSucceededWebhookEventObjectThe object of the event. Always
event.const EvalRunSucceededWebhookEventObjectEvent EvalRunSucceededWebhookEventObject = "event"
-
-
type FineTuningJobCancelledWebhookEvent struct{…}Sent when a fine-tuning job has been cancelled.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.
-
Data FineTuningJobCancelledWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the fine-tuning job.
-
-
Type FineTuningJobCancelledThe type of the event. Always
fine_tuning.job.cancelled.const FineTuningJobCancelledFineTuningJobCancelled FineTuningJobCancelled = "fine_tuning.job.cancelled"
-
Object FineTuningJobCancelledWebhookEventObjectThe object of the event. Always
event.const FineTuningJobCancelledWebhookEventObjectEvent FineTuningJobCancelledWebhookEventObject = "event"
-
-
type FineTuningJobFailedWebhookEvent struct{…}Sent when a fine-tuning job has failed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the fine-tuning job failed.
-
Data FineTuningJobFailedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the fine-tuning job.
-
-
Type FineTuningJobFailedThe type of the event. Always
fine_tuning.job.failed.const FineTuningJobFailedFineTuningJobFailed FineTuningJobFailed = "fine_tuning.job.failed"
-
Object FineTuningJobFailedWebhookEventObjectThe object of the event. Always
event.const FineTuningJobFailedWebhookEventObjectEvent FineTuningJobFailedWebhookEventObject = "event"
-
-
type FineTuningJobSucceededWebhookEvent struct{…}Sent when a fine-tuning job has succeeded.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the fine-tuning job succeeded.
-
Data FineTuningJobSucceededWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the fine-tuning job.
-
-
Type FineTuningJobSucceededThe type of the event. Always
fine_tuning.job.succeeded.const FineTuningJobSucceededFineTuningJobSucceeded FineTuningJobSucceeded = "fine_tuning.job.succeeded"
-
Object FineTuningJobSucceededWebhookEventObjectThe object of the event. Always
event.const FineTuningJobSucceededWebhookEventObjectEvent FineTuningJobSucceededWebhookEventObject = "event"
-
-
type RealtimeCallIncomingWebhookEvent struct{…}Sent when Realtime API Receives a incoming SIP call.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response was completed.
-
Data RealtimeCallIncomingWebhookEventDataEvent data payload.
-
CallID stringThe unique ID of this call.
-
SipHeaders []RealtimeCallIncomingWebhookEventDataSipHeaderHeaders from the SIP Invite.
-
Name stringName of the SIP Header.
-
Value stringValue of the SIP Header.
-
-
-
Type RealtimeCallIncomingThe type of the event. Always
realtime.call.incoming.const RealtimeCallIncomingRealtimeCallIncoming RealtimeCallIncoming = "realtime.call.incoming"
-
Object RealtimeCallIncomingWebhookEventObjectThe object of the event. Always
event.const RealtimeCallIncomingWebhookEventObjectEvent RealtimeCallIncomingWebhookEventObject = "event"
-
-
type ResponseCancelledWebhookEvent struct{…}Sent when a background response has been cancelled.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response was cancelled.
-
Data ResponseCancelledWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the model response.
-
-
Type ResponseCancelledThe type of the event. Always
response.cancelled.const ResponseCancelledResponseCancelled ResponseCancelled = "response.cancelled"
-
Object ResponseCancelledWebhookEventObjectThe object of the event. Always
event.const ResponseCancelledWebhookEventObjectEvent ResponseCancelledWebhookEventObject = "event"
-
-
type ResponseCompletedWebhookEvent struct{…}Sent when a background response has been completed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response was completed.
-
Data ResponseCompletedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the model response.
-
-
Type ResponseCompletedThe type of the event. Always
response.completed.const ResponseCompletedResponseCompleted ResponseCompleted = "response.completed"
-
Object ResponseCompletedWebhookEventObjectThe object of the event. Always
event.const ResponseCompletedWebhookEventObjectEvent ResponseCompletedWebhookEventObject = "event"
-
-
type ResponseFailedWebhookEvent struct{…}Sent when a background response has failed.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response failed.
-
Data ResponseFailedWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the model response.
-
-
Type ResponseFailedThe type of the event. Always
response.failed.const ResponseFailedResponseFailed ResponseFailed = "response.failed"
-
Object ResponseFailedWebhookEventObjectThe object of the event. Always
event.const ResponseFailedWebhookEventObjectEvent ResponseFailedWebhookEventObject = "event"
-
-
type ResponseIncompleteWebhookEvent struct{…}Sent when a background response has been interrupted.
-
ID stringThe unique ID of the event.
-
CreatedAt int64The Unix timestamp (in seconds) of when the model response was interrupted.
-
Data ResponseIncompleteWebhookEventDataEvent data payload.
-
ID stringThe unique ID of the model response.
-
-
Type ResponseIncompleteThe type of the event. Always
response.incomplete.const ResponseIncompleteResponseIncomplete ResponseIncomplete = "response.incomplete"
-
Object ResponseIncompleteWebhookEventObjectThe object of the event. Always
event.const ResponseIncompleteWebhookEventObjectEvent ResponseIncompleteWebhookEventObject = "event"
-
-