Package Exports
- slack-web-api-client
- slack-web-api-client/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (slack-web-api-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Slack Web API Client for TypeScript
The slack-web-api-client library is a type-safe Slack Web API client library. The key benefits it provides are:
- A fetch-based implementation
- Strong types for Web API responses and Block Kit
- Zero additional dependency
Getting Started
npm package
You install the library by npm/yarn command as always:
npm i slack-web-api-clientimport { SlackAPIClient } from "slack-web-api-client";
const client = new SlackAPIClient(process.env.SLACK_BOT_TOKEN);
const response = await client.chat.postMessage({
channel: "#random",
text: "👋 what's up?",
});The second argument for more customize options is optional:
const client = new SlackAPIClient(process.env.SLACK_BOT_TOKEN, {
logLevel: "DEBUG",
});Deno module
You can use this library in Slack's automation platform too!
import { SlackFunction } from "deno-slack-sdk/mod.ts";
import { SlackAPIClient } from "https://deno.land/x/slack_web_api_client@0.1.4/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: [] },
});
export default SlackFunction(def, async ({ token }) => {
const client = new SlackAPIClient(token);
const repsonse = await client.chat.postMessage({
channel: "#random",
text: "👋 what's up?",
});
// ....
});