Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seratch/slack-web-api-client
Streamlined Slack Web API client for TypeScript
https://github.com/seratch/slack-web-api-client
chatbot deno nodejs slack slack-api slack-bot slackapi typescript web web-api webapi
Last synced: 7 days ago
JSON representation
Streamlined Slack Web API client for TypeScript
- Host: GitHub
- URL: https://github.com/seratch/slack-web-api-client
- Owner: seratch
- License: mit
- Created: 2023-04-26T02:01:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-29T02:02:17.000Z (3 months ago)
- Last Synced: 2024-10-29T16:43:28.153Z (3 months ago)
- Topics: chatbot, deno, nodejs, slack, slack-api, slack-bot, slackapi, typescript, web, web-api, webapi
- Language: TypeScript
- Homepage:
- Size: 1.69 MB
- Stars: 32
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## Slack Web API Client for TypeScript
[![npm version](https://badge.fury.io/js/slack-web-api-client.svg)](https://badge.fury.io/js/slack-web-api-client)
[![deno module](https://shield.deno.dev/x/slack_web_api_client)](https://deno.land/x/slack_web_api_client)
[![JSR](https://jsr.io/badges/@seratch/slack-web-api-client)](https://jsr.io/@seratch/slack-web-api-client)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 obstaclesIf you're looking for a solution to utilize the full features of the Slack platform, [**slack-edge**](https://github.com/seratch/slack-edge) is the one for you. The **slack-edge** library uses this **slack-web-api-client** internally, making it compatible with most JavaScript/TypeScript runtimes.
### Getting Started
#### Working with the npm package
To install the **slack-web-api-client** library, simply use the standard npm/yarn command:
```
npm i slack-web-api-client@latest
```Once you have added the **slack-web-api-client** library to your project's dependencies using the npm/yarn command, you can easily import any functionality you need from `"slack-web-api-client"` in your TypeScript code:
```typescript
import { SlackAPIClient } from "slack-web-api-client";const client = new SlackAPIClient(process.env.SLACK_BOT_TOKEN);
const response = await client.chat.postMessage({
channel: "#random",
text: ":wave: what's up?",
});
```The second argument of the constructor allows for optional customizations:
```typescript
const client = new SlackAPIClient(process.env.SLACK_BOT_TOKEN, {
logLevel: "DEBUG", // default: "INFO"
throwSlackAPIError: false, // default: true
});
```This argument, if provided, allows for further configuration of **SlackAPIClient** instance to fit your specific needs.
#### Working with the Deno module
Please refer to [README for the Deno module](https://github.com/seratch/slack-web-api-client/blob/main/src_deno/README.md).