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

Method sendEvent

packages/trigger-sdk/src/io.ts:734–754  ·  view source on GitHub ↗

`io.sendEvent()` allows you to send an event from inside a Job run. The sent event will trigger any Jobs that are listening for that event (based on the name). * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concept

(cacheKey: string | any[], event: SendEvent, options?: SendEventOptions)

Source from the content-addressed store, hash-verified

732 * @param options Options for sending the event.
733 */
734 async sendEvent(cacheKey: string | any[], event: SendEvent, options?: SendEventOptions) {
735 return await this.runTask(
736 cacheKey,
737 async (task) => {
738 return await this._triggerClient.sendEvent(event, options);
739 },
740 {
741 name: "Send Event",
742 params: { event, options },
743 icon: "send",
744 properties: [
745 {
746 label: "name",
747 text: event.name,
748 },
749 ...(event?.id ? [{ label: "ID", text: event.id }] : []),
750 ...sendEventOptionsProperties(options),
751 ],
752 }
753 );
754 }
755
756 /** `io.sendEvents()` allows you to send multiple events from inside a Job run. The sent events will trigger any Jobs that are listening for those events (based on the name).
757 * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.

Callers 8

createJobTesterFunction · 0.45
TelemetryClass · 0.45
sendEventFunction · 0.45
createWebhookEventSourceFunction · 0.45
events.tsFile · 0.45
built-ins.tsFile · 0.45
sendReactHookEventFunction · 0.45
POSTFunction · 0.45

Calls 2

runTaskMethod · 0.95

Tested by

no test coverage detected