Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jobs Showcase

This repo contains a set of jobs that can be run locally using the @trigger.dev/cli and @trigger.dev/express packages. The jobs included in this repo are.

Status Title Description Integrations
Cron scheduled basic A scheduled Job which runs at 2:30pm every Monday. None
Delay example joke Logs a message to the console, waits for 5 minutes, and then logs another message. None
GitHub: issue reminder Sends a Slack message to a channel if a GitHub issue is left open for 24 hours. GitHub, Slack
GitHub: new issue opened Runs when a new issue is opened on a repo you have admin rights to, once created, it will add a 'Bug' label to the issue. GitHub
OpenAI: generate image Generate an image from a prompt, using OpenAI. OpenAI
OpenAI: tell me a joke Generate a joke from a prompt, using OpenAI. OpenAI
Resend: send basic email Sends a basic email using Resend. Resend
Scheduled interval basic Runs every 60 seconds, starting 60 seconds after this Job is first indexed. None
SendGrid: send basic email Sends a basic email using SendGrid. SendGrid
Slack: post message Posts a message to a Slack channel. Slack
Stripe: on subscription created Runs when a new subscription is created in Stripe. Stripe
Supabase: update database when a Stripe account is updated Update a Supabase table when a Stripe account is updated. Supabase, Stripe

Setup: how to use this repo

You will need to create a .env file. You can duplicate the contents of .env.example file and set your local (Dev 'server') TRIGGER_API_KEY value. You can find your API key in your project's integrations page in the app. Add other API keys as needed.

Install packages

First, install the packages:

npm i

Running a job

Each file in src is either a Job or a separate set of jobs that can be run separately. For example, the src/cronScheduledBasic.ts file can be run with:

npm run cronscheduledbasic

This will open up a local server using express on port 8080. Then in a separate terminal window you can run the @trigger.dev/cli dev command:

npm run dev:trigger

Contributors guide

You can add a new file to src with it's own TriggerClient and set of jobs (e.g. src/events.ts)

import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
import { createExpressServer } from "@trigger.dev/express";
import { z } from "zod";

export const client = new TriggerClient({ id: "job-catalog" });

client.defineJob({
  id: "example-job-1",
  name: "Example Job 1",
  version: "0.1.0",
  trigger: eventTrigger({
    name: "example.one",
  }),
  run: async (payload, io, ctx) => {},
});

createExpressServer(client);

Then add a new script in package.json:

{
  "scripts": {
    "events": "nodemon --watch src/events.ts -r tsconfig-paths/register -r dotenv/config src/events.ts"
  }
}

About

⚡️ An ever-growing library of Trigger.dev jobs for anyone to use and contribute to.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages