MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / getPayload

Function getPayload

integrations/airtable/src/webhooks.ts:422–446  ·  view source on GitHub ↗
(
  baseId: string,
  webhookId: string,
  sdk: AirtableSDK,
  cursor: number | undefined
)

Source from the content-addressed store, hash-verified

420}
421
422async function getPayload(
423 baseId: string,
424 webhookId: string,
425 sdk: AirtableSDK,
426 cursor: number | undefined
427) {
428 const url = new URL(`${apiUrl}/${baseId}/webhooks/${webhookId}/payloads`);
429 if (cursor) {
430 url.searchParams.append("cursor", cursor.toString());
431 }
432
433 const response = await fetch(url.href, {
434 headers: {
435 Authorization: `Bearer ${sdk._apiKey}`,
436 },
437 redirect: "follow",
438 });
439
440 if (!response.ok) {
441 throw new Error(`Failed to list webhooks: ${response.statusText}`);
442 }
443
444 const webhook = await response.json();
445 return ListWebhooksResponseSchema.parse(webhook);
446}
447
448async function handleWebhookError(response: Response, errorType: string) {
449 const rawErrorBody = await response.json();

Callers 1

getAllPayloadsFunction · 0.85

Calls 4

toStringMethod · 0.80
jsonMethod · 0.80
parseMethod · 0.80
fetchFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…