Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ba54743
Fixed broken twitter badge and updated cooy
D-K-P Jan 23, 2023
a97b759
Added twitter and discord to the footer
samejr Jan 23, 2023
fc6e787
Added discord link to onboarding
samejr Jan 23, 2023
e9818d2
Updated onboarding image
samejr Jan 23, 2023
4c48390
Added new icons for the examples page
samejr Jan 23, 2023
4d6eabb
Removed link to the app in the docs footer
samejr Jan 23, 2023
5a32765
Replaced docs favicon
D-K-P Jan 23, 2023
8d9587b
Resend and SendGrid logos
samejr Jan 23, 2023
ada6e43
Added help section to the docs
D-K-P Jan 23, 2023
39b167e
Zod guide and better handling of Zod event parsing errors
ericallam Jan 23, 2023
a054360
Update mintlify CLI to the latest version
ericallam Jan 23, 2023
2020b0a
Changed discord and gh links
D-K-P Jan 23, 2023
748494c
Document the issues github webhook
ericallam Jan 23, 2023
45e64b9
Add EDA guide coming soon
ericallam Jan 23, 2023
62a5163
Updated resend logo
samejr Jan 23, 2023
5dac886
Resend is sending html emails successfully
matt-aitken Jan 23, 2023
9ecabd4
Updated resend logo
samejr Jan 23, 2023
98fca0e
Added a welcome page and GitHub link to side nav
samejr Jan 24, 2023
08179a0
React emails are sending
matt-aitken Jan 24, 2023
c41026d
Emails are now correctly reporting in the webapp
matt-aitken Jan 24, 2023
fb11417
Added an intro page to the docs
samejr Jan 24, 2023
84bb476
fixed typos
samejr Jan 24, 2023
1c37332
Added more info to the examples page
samejr Jan 24, 2023
780688e
Added a background image to docs
samejr Jan 24, 2023
681955c
Added resumability guide
ericallam Jan 24, 2023
dc11dac
Finished docs for github webhooks
ericallam Jan 24, 2023
a2d11a2
Added some docs for logging
ericallam Jan 24, 2023
951bf9a
Added loops and conditionals
ericallam Jan 24, 2023
d717a90
Added private beta banners to the docs
D-K-P Jan 24, 2023
eebe371
Replaced readme banner
D-K-P Jan 24, 2023
aceceec
Updated readme
D-K-P Jan 24, 2023
36480dd
Email preview in the run
matt-aitken Jan 24, 2023
0300805
Improvements for plain text formatting
matt-aitken Jan 24, 2023
77f3233
Improved the Resend API key instructions
matt-aitken Jan 24, 2023
46521a3
Deal with Resend errors properly
matt-aitken Jan 24, 2023
042dd92
Merge branch 'integrations/resend' into dev
matt-aitken Jan 24, 2023
3b6b8f5
Use x-github-hook-id for the event id, because x-github-delivery-id i…
ericallam Jan 24, 2023
a8f8125
Add documentation for Resend.com sendEmail integration
ericallam Jan 24, 2023
c570f06
Added resend.com changeset
ericallam Jan 24, 2023
7be5433
Release new versions of packages
ericallam Jan 24, 2023
f6b7b4a
Updated the docs demo gif
samejr Jan 24, 2023
8541ec6
Compressed docs images
samejr Jan 24, 2023
1cc3977
Copy tweak
samejr Jan 24, 2023
d6b69ab
If an unknown webhook service is presented, show the service
matt-aitken Jan 24, 2023
3caa793
If a run is disabled, show an appropriate error
matt-aitken Jan 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
![](apps/webapp/public/images/coming-soon-banner.png)
### The Trigger.dev Private beta is now open. Sign up for access [here](https://bcymafitv0e.typeform.com/tddsignup#source=GitHubReadme).

 

### We are now accepting users 😊! Request early access [here](https://bcymafitv0e.typeform.com/tddsignup#source=GitHubReadme).
![Hero](https://raw.githubusercontent.com/triggerdotdev/trigger.dev/eebe37109e33beae6390ee19029fce8a5934c84b/apps/webapp/public/images/logo-banner.png)

 

---

Expand All @@ -12,7 +12,9 @@

![Logo](https://trigger.dev/_next/static/media/triggerdotdev-logo.9226e5d0.png?imwidth=256)

[![Twitter Follow](https://img.shields.io/twitter/follow/triggerdotdev)](https://twitter.com/intent/follow?screen_name=triggerdotdev)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/triggerdotdev.svg?style=social&label=Follow%20%40trigger.dev)](https://twitter.com/triggerdotdev)



# ⚙️ Automate complex workflows with code

Expand Down
29 changes: 19 additions & 10 deletions apps/docs/examples/examples.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
---
title: "Example workflows"
sidebarTitle: "Example workflows"
description: "Example workflows."
sidebarTitle: "Overview"
description: "Example workflows to use in your projects."
---

# Example workflows
<Warning>
Trigger.dev is in private beta. We are now inviting users from our waitlist
[here.](https://bcymafitv0e.typeform.com/tddsignup?typeform-source=trigger.dev#source=Docs)
</Warning>

Not sure what to build? Take a look through our examples for inspiration.
You can use these workflows in your product by following the instructions on each page.

<CardGroup>
<Card title="GitHub" icon="rectangle-terminal" href="/examples/github"></Card>
<Card
title="Shopify"
icon="rectangle-terminal"
href="/examples/shopify"
></Card>
<Card title="Slack" icon="rectangle-terminal" href="/examples/slack"></Card>
<Card title="GitHub" icon="github" href="/examples/github">
When a GitHub issue is created or modified, post a message to Slack.
</Card>
<Card title="Shopify" icon="shopify" href="/examples/shopify">
Create a new product in my Shopify store.
</Card>
<Card title="Slack" icon="slack" href="/examples/slack">
Post to Slack when a GitHub issue is created or modified.
</Card>
<Card title="Resend" icon="envelope" href="/examples/resend"></Card>
</CardGroup>
36 changes: 35 additions & 1 deletion apps/docs/functions/logging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,38 @@ sidebarTitle: "Logging"
description: "There are 4 different types of logs you can add as workflow steps."
---

## Coming soon
If you'd like to add additional logging to your workflow run, you can use our built-in logging utility

## Usage

```ts
import { Trigger } from "@trigger.dev/sdk";

new Trigger({
id: "my-trigger",
on: scheduleEvent({ rateOf: { minutes: 5 } }),
run: async (event, ctx) => {
await ctx.logger.info("It's been 5 minutes since the last run!");
},
}).listen();
```

This will log the message to your workflow run page in the Trigger dashboard

There are 4 different types of logs you can add as workflow steps:

```ts
await ctx.logger.info("It's been 5 minutes since the last run!");
await ctx.logger.debug("This is a debug log");
await ctx.logger.warn("This is a warning");
await ctx.logger.error("This is an error");
```

You can also include a second argument to the logger to add additional metadata to the log:

```ts
await ctx.logger.info("It's been 5 minutes since the last run!", {
foo: "bar",
baz: 123,
});
```
45 changes: 44 additions & 1 deletion apps/docs/functions/loops-conditionals-etc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,47 @@ sidebarTitle: "Loops, Conditionals…"
description: "Write any type of code."
---

## Coming soon
Currently, we don't have anything special for loops or conditionals. You can just write plain-old TypeScript code and it will Just Work™.

## Loops

When you perform an action (sendEvent, delays, etc.) inside of a loop, make sure to create unique keys for each action to make sure that your workflows are [Resumable](/guides/resumability):

```ts
for (let i = 0; i < 10; i++) {
await ctx.waitFor(`Wait ${i}`, { seconds: 30 });

await slack.postMessage(`⭐️ New Star ${i}`, {
channelName: "github-stars",
text: `@${starredBy} just starred ${repoName}!`,
});
}
```

## Parallel Execution

You can run actions in parallel using `Promise.all`, like so:

```ts
await Promise.all(
messages.map((message) =>
slack.postMessage(message.id, {
channelName: "github-stars",
text: message.text,
})
)
);
```

## Conditionals

You can use `if` statements to conditionally execute code, just like normal code:

```ts
if (ctx.event.payload.action === "opened") {
await slack.postMessage("New Issue", {
channelName: "github-issues",
text: `@${ctx.event.payload.sender.login} just opened an issue!`,
});
}
```
26 changes: 26 additions & 0 deletions apps/docs/get-help.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "Get in touch with us!"
sidebarTitle: "Get help"
description: "Contact us if you have any questions, or would like help with any issues."
---

<Note>We are active in the community and will respond to all messages.</Note>

Please email us at <a href="mailto:help@trigger.dev">help@trigger.dev</a> or choose one of the options below:

<CardGroup>
<Card
title="Join the communty"
icon="discord"
href="https://discord.gg/nkqV9xBYWy"
>
The place to meet other users, the team and to get product updates.
</Card>
<Card
title="Schedule a call"
icon="video"
href="https://cal.com/team/triggerdotdev/support"
>
A call with someone from our support team. We are happy to help.
</Card>
</CardGroup>
27 changes: 22 additions & 5 deletions apps/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ sidebarTitle: "Quick start"
description: "Get your first workflow running in just a few minutes"
---

<Warning>
Trigger.dev is in private beta. We are now inviting users from our waitlist
[here.](https://bcymafitv0e.typeform.com/tddsignup?typeform-source=trigger.dev#source=Docs)
</Warning>

Trigger.dev workflows are written in your codebase and run in your existing infrastructure. This means:

- They are version controlled with the rest of your code.
Expand Down Expand Up @@ -182,6 +187,15 @@ When you run your server and this code executes, it will trigger the workflow. Y

## Next steps

<Card
title="Join the communty"
icon="discord"
href="https://discord.gg/nkqV9xBYWy"
>
Meet other users, get help and product updates. We will respond to all
messages and will help with any issues.
</Card>

There are many things we didn't cover here, including Webhook and Scheduled triggers. Below are a some more features to explore:

### Triggers
Expand All @@ -192,13 +206,13 @@ Triggers are what cause your workflows to run.
<Card title="Webhooks" icon="rectangle-terminal" href="/triggers/webhooks">
Easily subscribe to the APIs you're using
</Card>
<Card title="Scheduled" icon="sliders" href="/triggers/scheduled">
<Card title="Scheduled" icon="clock" href="/triggers/scheduled">
Trigger your workflows on a repeating schedule
</Card>
<Card title="Custom events" icon="heading" href="/triggers/custom-events">
<Card title="Custom events" icon="code" href="/triggers/custom-events">
More details on custom events
</Card>
<Card title="More coming soon" icon="heading">
<Card title="More coming soon" icon="bookmark">
On received email, HTTP endpoint and AWS Event Bridge
</Card>
</CardGroup>
Expand All @@ -213,11 +227,14 @@ Triggers are what cause your workflows to run.
>
We are making it easy to use lots of APIs by adding integrations.
</Card>
<Card title="Delays" icon="sliders" href="/functions/delays">
<Card title="Fetch" icon="server" href="/functions/fetch">
Call any API from your workflow
</Card>
<Card title="Delays" icon="alarm-clock" href="/functions/delays">
Add delays to your workflows. They're resilient so it doesn't matter if your
server goes down.
</Card>
<Card title="Send event" icon="heading" href="/functions/send-event">
<Card title="Send event" icon="code" href="/functions/send-event">
Send an event, to trigger a custom event workflow
</Card>
</CardGroup>
9 changes: 9 additions & 0 deletions apps/docs/guides/event-driven.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Event Driven Architecture"
sidebarTitle: "Event Driven"
description: "How to build an event driven architecture using Trigger.dev"
---

## Intro

Coming soon...
69 changes: 67 additions & 2 deletions apps/docs/guides/resumability.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,72 @@
---
title: "Resumability"
sidebarTitle: "Keys and Resumability"
description: "Keys and Resumability"
description: "Understand how keys work to ensure resumability of long-running workflows in Trigger.dev"
---

## Coming soon
## Intro

In this article, we'll cover how Trigger.dev handles resumability of long-running workflows. We'll also cover how to use keys to ensure that your workflows are resumable.

## What is resumability?

Resumability is the ability of a workflow run to continue from where it left off after a failure or interruption. For example, if a workflow run is interrupted due to a network failure, it should be able to resume from where it left off when the network is back up.

We accomplish this by storing the state of the workflow run in a database, and when a workflow run is resumed we will call the `Trigger.run` function again.

We use step "keys" to determine which steps have already been executed. If a step has already been executed, we will skip it and move on to the next step.

## How to use keys

Like we mentioned above, we use step keys to determine which steps have already been executed. They are defined by you inside your `Trigger.run` function, for example when you call `slack.postMessage`:

```ts
await slack.postMessage("⭐️ New Star", {
channelName: "github-stars",
text: `@${starredBy} just starred ${repoName}!`,
});
```

In this example, the key is the string `"⭐️ New Star"`. This means that if the workflow is interrupted and then resumed, the `slack.postMessage` step will be skipped because it has already been executed.

If you make multiple calls to `slack.postMessage`, you should use different keys for each call. For example:

```ts
await slack.postMessage("⭐️ New Star", {
channelName: "github-stars",
text: `@${starredBy} just starred ${repoName}!`,
});

await slack.postMessage("🚨 Critical Issue", {
channelName: "critical-issues",
text: `@${assignee} just opened a critical issue in ${repoName}!`,
});
```

If you are calling a step multiple times with the same key, it will only be executed once. For example, if you call `slack.postMessage` with the key `"⭐️ New Star"` twice, it will only be executed once.

## How to use keys with loops

If you are using a loop, you should use the loop index as the key. For example:

```ts
for (let i = 0; i < 10; i++) {
await ctx.waitFor(`Wait ${i}`, { seconds: 30 });

await slack.postMessage(`⭐️ New Star ${i}`, {
channelName: "github-stars",
text: `@${starredBy} just starred ${repoName}!`,
});
}
```

## When to use keys

The following functions in Trigger.dev require a `key` parameter:

- Integration actions (e.g. `slack.postMessage`)
- [delays](/functions/delays)
- [sendEvent](/functions/send-event)
- [fetch](/functions/fetch)

[Logging](/functions/logging) does not require a key, as we are currently using the log message as the key.
Loading