MCPcopy
hub / github.com/triggerdotdev/trigger.dev / invokeJob

Method invokeJob

packages/trigger-sdk/src/apiClient.ts:542–567  ·  view source on GitHub ↗
(jobId: string, payload: any, options: InvokeOptions = {})

Source from the content-addressed store, hash-verified

540 }
541
542 async invokeJob(jobId: string, payload: any, options: InvokeOptions = {}) {
543 const apiKey = await this.#apiKey();
544
545 this.#logger.debug("Invoking Job", {
546 jobId,
547 });
548
549 const body: InvokeJobRequestBody = {
550 payload,
551 context: options.context ?? {},
552 options: {
553 accountId: options.accountId,
554 callbackUrl: options.callbackUrl,
555 },
556 };
557
558 return await zodfetch(InvokeJobResponseSchema, `${this.#apiUrl}/api/v1/jobs/${jobId}/invoke`, {
559 method: "POST",
560 headers: {
561 "Content-Type": "application/json",
562 Authorization: `Bearer ${apiKey}`,
563 ...(options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}),
564 },
565 body: JSON.stringify(body),
566 });
567 }
568
569 async cancelRunsForJob(jobId: string) {
570 const apiKey = await this.#apiKey();

Callers 2

invokeMethod · 0.45

Calls 3

#apiKeyMethod · 0.95
zodfetchFunction · 0.70
debugMethod · 0.65

Tested by

no test coverage detected