diff --git a/docs/integrations/apis/slack-tasks.mdx b/docs/integrations/apis/slack-tasks.mdx new file mode 100644 index 00000000000..04ebd85f62e --- /dev/null +++ b/docs/integrations/apis/slack-tasks.mdx @@ -0,0 +1,48 @@ +--- +title: Slack tasks +sidebarTitle: Tasks +--- + +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. + +--- + +## All tasks + +### `postMessage` + +Post a message to a channel. [Official Slack Docs](https://api.slack.com/methods/chat.postMessage) + +```ts example.ts +// Send a Slack message using the io.slack.postMessage function +const response = await io.slack.postMessage("post message", { + // Specify the target channel by providing its ID + channel: "< your-channel-id >", + // Set the text content of the message + text: "My first Slack message", +}); + +``` +## Example Usage + +```ts +client.defineJob({ + id: "slack-test", + name: "Slack test", + version: "0.0.1", + trigger: eventTrigger({ + name: "slack.test", + schema: z.object({}), + }), + integrations: { + slack, + }, + run: async (payload, io, ctx) => { + const response = await io.slack.postMessage("post message", { + channel: "C04GWUTDC3W", + text: "My first Slack message", + }); + }, +}); +``` + diff --git a/docs/integrations/apis/slack.mdx b/docs/integrations/apis/slack.mdx index 53e6cbadf86..8b010202201 100644 --- a/docs/integrations/apis/slack.mdx +++ b/docs/integrations/apis/slack.mdx @@ -1,8 +1,23 @@ --- -title: Slack +title: Slack overview & authentication +sidebarTitle: Overview & authentication --- - +## Overview + +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. + +You can tailor triggers and tasks to your specific needs, ensuring that your team and processes are more productive and responsive. + +For examples of some of the things you can do with it, check out our Jobs Showcase: + + + Check out pre-built Slack jobs in our showcase. + ## Installation @@ -26,6 +41,10 @@ yarn add @trigger.dev/slack@latest Slack supports OAuth +## OAuth + +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). + ```ts import { Slack } from "@trigger.dev/slack"; @@ -33,32 +52,13 @@ const slack = new Slack({ id: "slack", }); ``` +## Tasks -## Example - -```ts -client.defineJob({ - id: "slack-test", - name: "Slack test", - version: "0.0.1", - trigger: eventTrigger({ - name: "slack.test", - schema: z.object({}), - }), - integrations: { - slack, - }, - run: async (payload, io, ctx) => { - const response = await io.slack.postMessage("post message", { - channel: "C04GWUTDC3W", - text: "My first Slack message", - }); - }, -}); -``` +Once you have set up a Slack client, you can use it to create tasks. -## Tasks + + + Perform tasks such as posting message to a channel. + + -| Function Name | Description | -| ------------- | --------------------------- | -| `postMessage` | Post a message to a channel | diff --git a/docs/mint.json b/docs/mint.json index 597903b837d..93780c3dc07 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -266,7 +266,13 @@ "integrations/apis/replicate", "integrations/apis/resend", "integrations/apis/sendgrid", - "integrations/apis/slack", + { + "group": "Slack", + "pages": [ + "integrations/apis/slack", + "integrations/apis/slack-tasks" + ] + }, "integrations/apis/stripe", { "group": "Supabase",