Skip to content

[TRI-1352] Add documentation for eventTrigger() examples option #534

Description

@matt-aitken

Is your feature request related to a problem? Please describe.

We support adding example payloads to eventTrigger() but haven't documented it. They will appear in the dashboard Test page:

CleanShot 2023-10-02 at 14 20 16

The syntax is this:

eventTrigger({
  name: "new.user",
  schema: z.object({
    userId: z.string(),
    tier: z.union([z.literal("free"), z.literal("pro")]),
  }),
  //⬇️ isn't documented
  examples: [
    {
      id: "issue.opened",
      name: "Issue opened",
      payload: {
        userId: "1234",
        tier: "free"
      },
      //optional
      icon: "github",
    },
  ],
});

Describe the solution you'd like to see

Add documentation to this page: https://trigger.dev/docs/sdk/eventtrigger

In the options parameters, like the others

Add to the sample code on the right-hand side, making it clear with a code comment that it's optional

This is the file in the code: https://github.com/triggerdotdev/trigger.dev/blob/main/docs/sdk/eventtrigger.mdx

Be sure that you have run the docs and tested that it works. It's very simple to run the docs: https://github.com/triggerdotdev/trigger.dev/blob/main/docs/README.md

TRI-1352

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions