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

Method create

integrations/airtable/src/webhooks.ts:83–128  ·  view source on GitHub ↗
(
    key: IntegrationTaskKey,
    { baseId, url, options }: { baseId: string; url: string; options: WebhookSpecification }
  )

Source from the content-addressed store, hash-verified

81 }
82
83 create(
84 key: IntegrationTaskKey,
85 { baseId, url, options }: { baseId: string; url: string; options: WebhookSpecification }
86 ): Promise<WebhookRegistrationData> {
87 return this.runTask(
88 key,
89 async (client, task, io) => {
90 const response = await fetch(`${apiUrl}/${baseId}/webhooks`, {
91 method: "POST",
92 headers: {
93 Authorization: `Bearer ${client._apiKey}`,
94 "Content-Type": "application/json",
95 },
96 body: JSON.stringify({
97 notificationUrl: url,
98 specification: {
99 options: {
100 ...options,
101 includes: {
102 includePreviousCellValues: true,
103 includePreviousFieldDefinitions: true,
104 },
105 },
106 },
107 }),
108 redirect: "follow",
109 });
110
111 if (!response.ok) {
112 await handleWebhookError(response, "WEBHOOK_CREATE");
113 }
114
115 const webhook = await response.json();
116 const parsed = WebhookRegistrationDataSchema.parse(webhook);
117 return parsed;
118 },
119 {
120 name: "Create webhook",
121 params: {
122 baseId,
123 url,
124 options,
125 },
126 }
127 );
128 }
129
130 list(key: IntegrationTaskKey, { baseId }: { baseId: string }): Promise<WebhookListData> {
131 return this.runTask(

Callers 1

updateMethod · 0.95

Calls 5

jsonMethod · 0.80
parseMethod · 0.80
handleWebhookErrorFunction · 0.70
fetchFunction · 0.50
runTaskMethod · 0.45

Tested by

no test coverage detected