Skip to content

Commit 2d4f85e

Browse files
authored
Merge pull request #667 from shelar1423/patch-4
Improved the Slack integration documentation
2 parents 044d38e + 2caa2a5 commit 2d4f85e

3 files changed

Lines changed: 83 additions & 29 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Slack tasks
3+
sidebarTitle: Tasks
4+
---
5+
6+
Tasks are executed after the job is triggered and are the main building blocks of a job. You can string together as many tasks as you want.
7+
8+
---
9+
10+
## All tasks
11+
12+
### `postMessage`
13+
14+
Post a message to a channel. [Official Slack Docs](https://api.slack.com/methods/chat.postMessage)
15+
16+
```ts example.ts
17+
// Send a Slack message using the io.slack.postMessage function
18+
const response = await io.slack.postMessage("post message", {
19+
// Specify the target channel by providing its ID
20+
channel: "< your-channel-id >",
21+
// Set the text content of the message
22+
text: "My first Slack message",
23+
});
24+
25+
```
26+
## Example Usage
27+
28+
```ts
29+
client.defineJob({
30+
id: "slack-test",
31+
name: "Slack test",
32+
version: "0.0.1",
33+
trigger: eventTrigger({
34+
name: "slack.test",
35+
schema: z.object({}),
36+
}),
37+
integrations: {
38+
slack,
39+
},
40+
run: async (payload, io, ctx) => {
41+
const response = await io.slack.postMessage("post message", {
42+
channel: "C04GWUTDC3W",
43+
text: "My first Slack message",
44+
});
45+
},
46+
});
47+
```
48+

docs/integrations/apis/slack.mdx

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
---
2-
title: Slack
2+
title: Slack overview & authentication
3+
sidebarTitle: Overview & authentication
34
---
45

5-
<Snippet file="integration-getting-started.mdx" />
6+
## Overview
7+
8+
Our Slack integration provides a powerful way to streamline communication and workflows within your organization, making it easier to stay informed, collaborate efficiently, and automate routine tasks.
9+
10+
You can tailor triggers and tasks to your specific needs, ensuring that your team and processes are more productive and responsive.
11+
12+
For examples of some of the things you can do with it, check out our Jobs Showcase:
13+
14+
<Card
15+
title="Jobs Showcase - Slack"
16+
icon="rocket"
17+
href="https://trigger.dev/showcase?tags=&integrations=slack"
18+
>
19+
Check out pre-built Slack jobs in our showcase.
20+
</Card>
621

722
## Installation
823

@@ -26,39 +41,24 @@ yarn add @trigger.dev/slack@latest
2641

2742
Slack supports OAuth
2843

44+
## OAuth
45+
46+
To use OAuth you can connect to Slack via the Trigger.dev [web app](https://cloud.trigger.dev). Click 'Integrations' in the side panel of any project, and configure Slack with the ID you want to use in your job and the required [scopes](https://api.slack.com/scopes).
47+
2948
```ts
3049
import { Slack } from "@trigger.dev/slack";
3150

3251
const slack = new Slack({
3352
id: "slack",
3453
});
3554
```
55+
## Tasks
3656

37-
## Example
38-
39-
```ts
40-
client.defineJob({
41-
id: "slack-test",
42-
name: "Slack test",
43-
version: "0.0.1",
44-
trigger: eventTrigger({
45-
name: "slack.test",
46-
schema: z.object({}),
47-
}),
48-
integrations: {
49-
slack,
50-
},
51-
run: async (payload, io, ctx) => {
52-
const response = await io.slack.postMessage("post message", {
53-
channel: "C04GWUTDC3W",
54-
text: "My first Slack message",
55-
});
56-
},
57-
});
58-
```
57+
Once you have set up a Slack client, you can use it to create tasks.
5958

60-
## Tasks
59+
<CardGroup>
60+
<Card title="Tasks" icon="sparkles" href="/integrations/apis/slack-tasks">
61+
Perform tasks such as posting message to a channel.
62+
</Card>
63+
</CardGroup>
6164

62-
| Function Name | Description |
63-
| ------------- | --------------------------- |
64-
| `postMessage` | Post a message to a channel |

docs/mint.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,13 @@
266266
"integrations/apis/replicate",
267267
"integrations/apis/resend",
268268
"integrations/apis/sendgrid",
269-
"integrations/apis/slack",
269+
{
270+
"group": "Slack",
271+
"pages": [
272+
"integrations/apis/slack",
273+
"integrations/apis/slack-tasks"
274+
]
275+
},
270276
"integrations/apis/stripe",
271277
{
272278
"group": "Supabase",

0 commit comments

Comments
 (0)