slackbee

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2020 License: AGPL-3.0 Imports: 5 Imported by: 4

README

Slack bee

The Slack bee can send and listen to messages in a Slack channel.

Configuration

Options
"Bees":[
   {
      "Name":"slackmsg",
      "Class":"slackbee",
      "Description":"slackbee",
      "Options":[
         {
            "Name":"apiKey",
            "Value":"env://SLACK_KEY"
         },
         {
            "Name":"channels",
            "Value":["rubiojr-test"]
         }
      ]
   }
]

apiKey: Slack API Key. You can get one from https://api.slack.com/docs/oauth-test-tokens.

The API key can be added to the recipe/config as-is, via environment variable (env://MY_API_KEY) or read from a file (file:///Users/rubiojr/.slack_key).

channels: The slack channels to listen on.

Actions

send: send a message to a Slack channel. Needs the name of the channel (not the channel ID), and the text to send. You can use interpolation to send something from the event received:

"Elements":[
   {
      "Action":{
         "Bee":"slackmsg",
         "Name":"send",
         "Options":[
            {
               "Name":"channel",
               "Value":"rubiojr-test2"
            },
            {
               "Name":"text",
               "Value":"{{.something}}"
            }
         ]
      }
   }
]

Credits

Slack logo: https://remoteworkspain.slack.com/brand-guidelines

Documentation

Overview

Package slackbee is a Bee that can connect to Slack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SlackBee

type SlackBee struct {
	bees.Bee
	// contains filtered or unexported fields
}

SlackBee is a Bee that can connect to Slack.

func (*SlackBee) Action

func (mod *SlackBee) Action(action bees.Action) []bees.Placeholder

Action triggers the action passed to it.

func (*SlackBee) ReloadOptions

func (mod *SlackBee) ReloadOptions(options bees.BeeOptions)

ReloadOptions parses the config options and initializes the Bee.

func (*SlackBee) Run

func (mod *SlackBee) Run(eventChan chan bees.Event)

Run executes the Bee's event loop.

type SlackBeeFactory

type SlackBeeFactory struct {
	bees.BeeFactory
}

SlackBeeFactory is a factory for SlackBees.

func (*SlackBeeFactory) Actions

func (factory *SlackBeeFactory) Actions() []bees.ActionDescriptor

Actions describes the available actions provided by this Bee.

func (*SlackBeeFactory) Description

func (factory *SlackBeeFactory) Description() string

Description returns the description of this Bee.

func (*SlackBeeFactory) Events

func (factory *SlackBeeFactory) Events() []bees.EventDescriptor

Events describes the available events provided by this Bee.

func (*SlackBeeFactory) ID

func (factory *SlackBeeFactory) ID() string

ID returns the ID of this Bee.

func (*SlackBeeFactory) Image

func (factory *SlackBeeFactory) Image() string

Image returns the filename of an image for this Bee.

func (*SlackBeeFactory) LogoColor

func (factory *SlackBeeFactory) LogoColor() string

LogoColor returns the preferred logo background color (used by the admin interface).

func (*SlackBeeFactory) Name

func (factory *SlackBeeFactory) Name() string

Name returns the name of this Bee.

func (*SlackBeeFactory) New

func (factory *SlackBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface

New returns a new Bee instance configured with the supplied options.

func (*SlackBeeFactory) Options

func (factory *SlackBeeFactory) Options() []bees.BeeOptionDescriptor

Options returns the options available to configure this Bee.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL