Skip to content
Get started

Retrieve

client.projects.webhookEndpoints.events.retrieve(stringeventID, EventRetrieveParams { projectId, webhookEndpointId } params, RequestOptionsoptions?): EventRetrieveResponse { webhookEvent }
GET/projects/{projectId}/webhook-endpoints/{webhookEndpointId}/events/{eventId}

Retrieve one delivery event of one of the project’s webhook endpoints

ParametersExpand Collapse
eventID: string
params: EventRetrieveParams { projectId, webhookEndpointId }
projectId: string

The project Id

webhookEndpointId: string

The webhook endpoint that delivered the event

ReturnsExpand Collapse
EventRetrieveResponse { webhookEvent }
webhookEvent: WebhookEvent { id, attempts, createdAt, 6 more }
id: string
attempts: Array<Attempt>
responseStatusCode: number
sentAt: string
createdAt: string
endpointId: string
payload: unknown
sentAt: string
status: "created" | "failed" | "retrying" | "success"
One of the following:
"created"
"failed"
"retrying"
"success"
type: "*" | "asset.download.completed" | "asset.download.created" | 16 more

Every event a webhook endpoint can subscribe to: a project endpoint takes the job lifecycle events, a team endpoint takes the alert events.

One of the following:
"*"
"asset.download.completed"
"asset.download.created"
"asset.download.failed"
"generation.completed"
"generation.created"
"generation.failed"
"inference.cancelled"
"inference.completed"
"inference.created"
"inference.failed"
"model.download.completed"
"model.download.created"
"model.download.failed"
"model.training.cancelled"
"model.training.completed"
"model.training.failed"
"model.training.started"
"team.credit.threshold.crossed"
updatedAt: string

Retrieve

import Scenario from '@scenario-labs/sdk';

const client = new Scenario({
  apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
  apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});

const event = await client.projects.webhookEndpoints.events.retrieve('eventId', {
  projectId: 'projectId',
  webhookEndpointId: 'webhookEndpointId',
});

console.log(event.webhookEvent);
{
  "webhookEvent": {
    "id": "id",
    "attempts": [
      {
        "responseStatusCode": 0,
        "sentAt": "sentAt"
      }
    ],
    "createdAt": "createdAt",
    "endpointId": "endpointId",
    "payload": {},
    "sentAt": "sentAt",
    "status": "created",
    "type": "*",
    "updatedAt": "updatedAt"
  }
}
Returns Examples
{
  "webhookEvent": {
    "id": "id",
    "attempts": [
      {
        "responseStatusCode": 0,
        "sentAt": "sentAt"
      }
    ],
    "createdAt": "createdAt",
    "endpointId": "endpointId",
    "payload": {},
    "sentAt": "sentAt",
    "status": "created",
    "type": "*",
    "updatedAt": "updatedAt"
  }
}