- 1.1.3Latest
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.13.5
- 0.13.4
- 0.13.3
- 0.13.2
- 0.13.1
- 0.13.0
- 0.12.1
- 0.12.0
- 0.11.1
- 0.11.0
- 0.10.5
- 0.10.4
- 0.10.3
- 0.10.2
- 0.10.1
- 0.10.0
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.6
- 0.7.5
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
Slack Web API Client for TypeScript
The slack-web-api-client library is a type-safe Slack Web API client that provides several key benefits, including:
- A fetch-based implementation, which is compatible with most runtimes
- Strong types for Web API responses and Block Kit, which make coding enjoyable and predictable
- Zero additional dependencies, allowing developers to integrate this library into their projects without any obstacles
Getting Started
The slack-web-api-client library also offers a native package for the Deno runtime. To import the module for Slack’s automation platform, use the following syntax:
import { SlackFunction } from "deno-slack-sdk/mod.ts";
export const def = DefineFunction({
callback_id: "hello",
title: "Hello World",
source_file: "functions/hello.ts",
input_parameters: { properties: {}, required: [] },
output_parameters: { properties: {}, required: [] },
});
import { SlackAPIClient } from "https://deno.land/x/slack_web_api_client@1.0.3/mod.ts";
export default SlackFunction(def, async ({ token }) => {
const client = new SlackAPIClient(token, {
throwSlackAPIError: false, // for the compatibility with deno-slack-api library
});
const response = await client.chat.postMessage({
channel: "#random",
text: ":wave: what's up?",
});
// ....
});
This allows you to use the powerful features of the slack-web-api-client library in your Deno projects with ease.
An alternative way is to use skypack CDN. If you prefer this way, you need to
add "cdn.skypack.dev"
to outgoingDomains
in manifest.ts
.
An alternative way to use the slack-web-api-client library is through the
skypack CDN. To do this, simply add "cdn.skypack.dev"
to the outgoingDomains
section in your manifest.ts
file. This allows you to use the library within
your project:
import { SlackAPIClient } from "https://cdn.skypack.dev/slack-web-api-client?dts";
Lastly, Slack’s automation platform doesn’t support jsr.io yet, though this library can be accessed there as well: https://jsr.io/@seratch/slack-web-api-client
// deno add @seratch/slack-web-api-client
import { SlackAPIClient } from "@seratch/slack-web-api-client.ts";
When you need this library for Deno apps outside the automation platform, relying on jsr.io could be a simpler approach for resolving dependencies.