/seneca-slack-provider

Seneca plugin that provides access to the Slack API.

Primary LanguageTypeScriptMIT LicenseMIT

Seneca Slack-Provider

Seneca Slack-Provider is a plugin for Seneca

Provides access to the Slack API using the Seneca provider convention. Slack API entities are represented as Seneca entities so that they can be accessed using the Seneca entity API and messages.

See seneca-entity and the Seneca Data Entities Tutorial for more details on the Seneca entity API.

NOTE: underlying third party SDK needs to be replaced as out of date and has a security issue.

npm version build Coverage Status Known Vulnerabilities DeepScan grade Maintainability

Voxgig This open source module is sponsored and supported by Voxgig.

Quick Example

// Setup - get the key value (<SECRET>) separately from a vault or
// environment variable.
Seneca()
  // Get API keys using the seneca-env plugin
  .use('env', {
    var: {
      $SLACK_TOKEN: String,
    }
  })
  .use('provider', {
    provider: {
      slack: {
        keys: {
          token: { value: '$SLACK_TOKEN' },
        }
      }
    }
  })
  .use('slack-provider')

let conversation = await seneca.entity('provider/slack/conversation')
  .list$({ id: '<slack-channel-id>' })

// get details of a channel
let channel = await seneca.entity('provider/slack/channel')
  .load$('<slack-channel-id>')

Console.log('CONVERSATION', conversation)

Install

$ npm install @seneca/slack-provider @seneca/env

Options

  • entity : object
  • debug : boolean
  • init$ : boolean

Action Patterns

Action Descriptions

« "action":"postMessage","service":"slack" »

Send a Slack message in a channel

Parameters

  • id : [Function: String]
  • text : [Function: String]

Replies With

{}

« "sys":"entity","base":"slack","cmd":"list","name":"channel","zone":"provider" »

List channel data into an entity.

Replies With

{}

« "sys":"entity","base":"slack","cmd":"list","name":"conversation","zone":"provider" »

List conversation data into an entity.

Replies With

{}

« "sys":"entity","base":"slack","cmd":"load","name":"channel","zone":"provider" »

Load channel data into an entity.

Replies With

{}

« "sys":"provider","get":"info","provider":"slack" »

Get information about the Slack SDK.


More Examples

Motivation

Support

Check out our sponsors and supporters, Voxgig, on their website here.

API

Contributing

The SenecaJS org encourages participation. If you feel you can help in any way, be it with bug reporting, documentation, examples, extra testing, or new features, feel free to create an issue, or better yet - submit a Pull Request. For more information on contribution, please see our Contributing Guide.

Background

Check out the SenecaJS roadmap here!