c0dfa8048a
* feat: BYO Auth Define client-side auth resolvers to be able to supply custom authentication credentials for integrations before a run is performed - Added new defineAuthResolver - Update all integrations to support the new auth resolvers - Strip internal symbols from .d.ts in integrations and trigger-sdk - Added BYO Auth docs - Update Dynamic Schedule to support associated account IDs - Create external accounts just-in-time - Added Account ID field to test job when there are external auth integrations - Show Account ID on run dashboard - Added new Run error state called “Unresolved auth” * Added changeset * Remove @internal from TriggerIntegration public methods * Add void to the result union * DynamicTriggers now work with the new BYO auth system, and added a bunch of docs and docs changes * Add additional key material for registering dynamic trigger task * Add new define* instance methods to the overview
56 lines
1.2 KiB
Plaintext
56 lines
1.2 KiB
Plaintext
---
|
|
title: "TriggerClient: sendEvent() instance method"
|
|
sidebarTitle: "sendEvent()"
|
|
description: "The `sendEvent()` instance method send an event that triggers any Jobs that are listening for that event (based on the name)."
|
|
---
|
|
|
|
You can call this function from anywhere in your backend to send an event. The other way to send an event is by using [io.sendEvent()](/sdk/io/sendevent) from inside a `run()` function.
|
|
|
|
Use [eventTrigger()](/sdk/eventtrigger) on a Job to listen for events.
|
|
|
|
## Parameters
|
|
|
|
<Snippet file="send-event-params.mdx" />
|
|
|
|
## Returns
|
|
|
|
<Snippet file="send-event-return.mdx" />
|
|
|
|
<RequestExample>
|
|
|
|
```ts Simple example with a payload
|
|
const event = client.sendEvent({
|
|
name: "new.user",
|
|
payload: {
|
|
userId: "u_1234567890",
|
|
},
|
|
});
|
|
```
|
|
|
|
```ts Send an event with an ID
|
|
const event = client.sendEvent({
|
|
id: "e_1234567890", // You can use this to deduplicate events
|
|
name: "new.user",
|
|
payload: {
|
|
userId: "u_1234567890",
|
|
},
|
|
});
|
|
```
|
|
|
|
```ts Send an event to be delivered later
|
|
const event = client.sendEvent(
|
|
{
|
|
id: "e_1234567890", // You can use this to deduplicate events
|
|
name: "new.user",
|
|
payload: {
|
|
userId: "u_1234567890",
|
|
},
|
|
},
|
|
{
|
|
deliverAt: new Date("2023-12-01T00:00:00.000Z"),
|
|
}
|
|
);
|
|
```
|
|
|
|
</RequestExample>
|