Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/khrj/slack-socket-mode

Recieve events from Slack's Events API over a WebSocket connection. Deno port of @slack/socket-mode
https://github.com/khrj/slack-socket-mode

deno slack slack-api socket-mode

Last synced: about 1 month ago
JSON representation

Recieve events from Slack's Events API over a WebSocket connection. Deno port of @slack/socket-mode

Awesome Lists containing this project

README

        


Socket icon

Slack Socket Mode



Recieve events from Slack's Events API over a WebSocket connection. Deno port of @slack/socket-mode



build status
language
code size
issues
license
version



View on deno.land








## Usage

```ts
import "https://deno.land/x/[email protected]/load.ts"
import { SocketModeClient } from "https://deno.land/x/[email protected]/mod.ts"

const appToken = Deno.env.get("SLACK_APP_TOKEN")
const socketModeClient = new SocketModeClient({ appToken })

// Attach listeners to events by type. See: https://api.slack.com/events/message
socketModeClient.addEventListener("message", ({ detail: { body, ack } }) => {
ack()
console.log(body)
})

await socketModeClient.start()
```

## API

- API is similar to the [node @slack/socket-mode](https://www.npmjs.com/package/@slack/socket-mode), where `.addEventListener` is used instead of `.on` ([EventTarget docs](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget))
- Complete [generated docs](https://doc.deno.land/https/deno.land/x/[email protected]/mod.ts) are also available

## Supporters

[![Stargazers repo roster for @khrj/slack-socket-mode](https://reporoster.com/stars/khrj/slack-socket-mode)](https://github.com/khrj/slack-socket-mode/stargazers)

[![Forkers repo roster for @khrj/slack-socket-mode](https://reporoster.com/forks/khrj/slack-socket-mode)](https://github.com/khrj/slack-socket-mode/network/members)

## Related

- [Deno Slack SDK](https://github.com/slack-deno/deno-slack-sdk)
- [Deno modules](https://github.com/khrj/deno-modules)