Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 16 additions & 1 deletion apps/docs/integrations/apis/slack/actions/post-message.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ In this examples there are two workflows:
1. Messages your team every minute (!) and asks them how they're doing.
2. Receives the interaction from users. It adds reactions when the buttons are pressed and posts a message when a user selects from the dropdown menu.

Please note, that to use `jsx-slack` you will need to add the `jsxImportSource` pragma to the top of your file. This is because `jsx-slack` is not a React library, but it uses the same syntax as React. Also, you might need to add `"jsx": "react-jsx"` to your `compilerOption` in `tsconfig.json`. The workflow file needs to be a `.jsx` or `.tsx` file (like when you use React).

<CodeGroup>

```typescript Blocks with interactivity
```typescript workflow.tsx
/** @jsxImportSource jsx-slack */
import { slack } from "@trigger.dev/integrations";
import JSXSlack, {
Actions,
Expand Down Expand Up @@ -207,6 +210,7 @@ new Trigger({
channelId: event.channel.id,
});
}
break;
}
case "status-help": {
//the user needs help so add an 🆘 emoji as a reaction
Expand All @@ -217,6 +221,7 @@ new Trigger({
channelId: event.channel.id,
});
}
break;
}
case "rating": {
if (action.type != "static_select") {
Expand Down Expand Up @@ -244,4 +249,14 @@ new Trigger({
}).listen();
```

```json tsconfig.json
{
//other options
"compilerOptions": {
"jsx": "react-jsx"
//other options
}
}
```

</CodeGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,18 @@ function WorkflowList({
}

function lastRunDescription(lastRun: WorkflowListItem["lastRun"]) {
if (lastRun === undefined) {
if (lastRun === null || lastRun === undefined) {
return "Never";
}

if (lastRun.status === "SUCCESS") {
if (lastRun.finishedAt) {
return formatDateTime(lastRun.finishedAt);
} else {
return "Unknown";
}
throw new Error("lastRun.finishedAt is undefined");
}

return runStatusLabel(lastRun.status);
}

Expand Down
2 changes: 2 additions & 0 deletions examples/send-to-slack/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ new Trigger({
channelId: event.channel.id,
});
}
break;
}
case "status-help": {
//the user needs help so add an 🆘 emoji as a reaction
Expand All @@ -231,6 +232,7 @@ new Trigger({
channelId: event.channel.id,
});
}
break;
}
case "rating": {
if (action.type != "static_select") {
Expand Down