From a6c9cac26cc73842719c141b71876b02bf02d051 Mon Sep 17 00:00:00 2001 From: dhselar1423 Date: Fri, 20 Oct 2023 18:30:03 +0530 Subject: [PATCH 1/4] slack docs --- docs/integrations/apis/slack-tasks.mdx | 26 ++++++++++++++ docs/integrations/apis/slack.mdx | 49 +++++++++++--------------- docs/mint.json | 24 ++++++++++--- 3 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 docs/integrations/apis/slack-tasks.mdx diff --git a/docs/integrations/apis/slack-tasks.mdx b/docs/integrations/apis/slack-tasks.mdx new file mode 100644 index 00000000000..a23f8b2ebb0 --- /dev/null +++ b/docs/integrations/apis/slack-tasks.mdx @@ -0,0 +1,26 @@ +--- +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: "C04GWUTDC3W", + // Set the text content of the message + text: "My first Slack message", +}); + +``` + diff --git a/docs/integrations/apis/slack.mdx b/docs/integrations/apis/slack.mdx index 53e6cbadf86..848aed47c11 100644 --- a/docs/integrations/apis/slack.mdx +++ b/docs/integrations/apis/slack.mdx @@ -1,8 +1,20 @@ --- -title: Slack +title: Plain overview & authentication +sidebarTitle: Overview & authentication --- - +## Overview + +The Slack platform allows you to extend and automate your workspaces to cultivate conversation, inspire action, and synergize services. + + + + Check out pre-built Plain jobs in our showcase. + ## Installation @@ -33,32 +45,13 @@ const slack = new Slack({ id: "slack", }); ``` +## Tasks -## Example +Once you have set up a Slack client, you can use it to create tasks. -```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", - }); - }, -}); -``` - -## 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 8c1399778df..a402df803ec 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -258,7 +258,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", @@ -325,7 +331,10 @@ "sdk/dynamictrigger/constructor", { "group": "Instance methods", - "pages": ["sdk/dynamictrigger/register", "sdk/dynamictrigger/unregister"] + "pages": [ + "sdk/dynamictrigger/register", + "sdk/dynamictrigger/unregister" + ] } ] }, @@ -336,7 +345,10 @@ "sdk/dynamicschedule/constructor", { "group": "Instance methods", - "pages": ["sdk/dynamicschedule/register", "sdk/dynamicschedule/unregister"] + "pages": [ + "sdk/dynamicschedule/register", + "sdk/dynamicschedule/unregister" + ] } ] }, @@ -357,7 +369,9 @@ }, { "group": "Overview", - "pages": ["examples/introduction"] + "pages": [ + "examples/introduction" + ] } ], "footerSocials": { @@ -370,4 +384,4 @@ "apiKey": "phc_hwYmedO564b3Ik8nhA4Csrb5SueY0EwFJWCbseGwWW" } } -} +} \ No newline at end of file From fde3f17a251b78de4f37e853358202dc99f6a41f Mon Sep 17 00:00:00 2001 From: dhselar1423 Date: Fri, 20 Oct 2023 19:00:41 +0530 Subject: [PATCH 2/4] fixed typos --- docs/integrations/apis/slack.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/integrations/apis/slack.mdx b/docs/integrations/apis/slack.mdx index 848aed47c11..23aedd31dab 100644 --- a/docs/integrations/apis/slack.mdx +++ b/docs/integrations/apis/slack.mdx @@ -1,5 +1,5 @@ --- -title: Plain overview & authentication +title: Slack overview & authentication sidebarTitle: Overview & authentication --- @@ -13,7 +13,7 @@ The Slack platform allows you to extend and automate your workspaces to cultivat icon="rocket" href="https://trigger.dev/showcase?tags=&integrations=slack" > - Check out pre-built Plain jobs in our showcase. + Check out pre-built Slack jobs in our showcase. ## Installation From 7ef61222ed2f83fac6b74e97ef2fd5e7acf02373 Mon Sep 17 00:00:00 2001 From: dhselar1423 Date: Fri, 20 Oct 2023 22:26:38 +0530 Subject: [PATCH 3/4] slack editing --- docs/integrations/apis/slack.mdx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/integrations/apis/slack.mdx b/docs/integrations/apis/slack.mdx index 23aedd31dab..218d3861d56 100644 --- a/docs/integrations/apis/slack.mdx +++ b/docs/integrations/apis/slack.mdx @@ -5,8 +5,11 @@ sidebarTitle: Overview & authentication ## Overview -The Slack platform allows you to extend and automate your workspaces to cultivate conversation, inspire action, and synergize services. +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: Date: Fri, 20 Oct 2023 23:11:41 +0530 Subject: [PATCH 4/4] slack fixes --- docs/integrations/apis/slack-tasks.mdx | 24 +++++++++++++++++++++++- docs/integrations/apis/slack.mdx | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/integrations/apis/slack-tasks.mdx b/docs/integrations/apis/slack-tasks.mdx index a23f8b2ebb0..04ebd85f62e 100644 --- a/docs/integrations/apis/slack-tasks.mdx +++ b/docs/integrations/apis/slack-tasks.mdx @@ -17,10 +17,32 @@ Post a message to a channel. [Official Slack Docs](https://api.slack.com/methods // 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: "C04GWUTDC3W", + 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 218d3861d56..8b010202201 100644 --- a/docs/integrations/apis/slack.mdx +++ b/docs/integrations/apis/slack.mdx @@ -43,7 +43,7 @@ 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/legacy/oauth-scopes). +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";