rocketchatbee

package
Version: 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: 7 Imported by: 0

README

Rocket.chat bee

The Rocket.Chat bee can send messages into a Rocket.Chat channel.

Configuration

Options
"Bees":[
   {
      "Name":"rocketchatmsg",
      "Class":"rocketchatbee",
      "Description":"my rocket.chat bee",
      "Options":[
         {
            "Name":"url",
            "Value":"http://localhost:3000"
         },
         {
            "Name":"user_id",
            "Value":"YOUR_USER_ID"
         },
         {
            "Name":"auth_token",
            "Value":"YOUR_AUTH_TOKEN"
         }
      ]
   }
]

See https://rocket.chat/docs/developer-guides/rest-api/personal-access-tokens/ for reference on how to create a user_id and auth_token.

Actions

send: send a message to a Rocket.Chat channel. This needs the name of the channel, and the text to send. If you specify an alias, messages posted appear under that username.

"Elements":[
   {
      "Action":{
         "Bee":"rocketchatmsg",
         "Name":"send",
         "Options":[
            {
               "Name":"channel",
               "Value":"info"
            },
            {
               "Name":"text",
               "Value":"This is the latest info!"
            },
            {
               "Name":"alias",
               "Value":"Informer"
            }
         ]
         ]
      }
   }
]

Documentation

Overview

Package rocketchatbee is a Bee that can connect to Rocketchat.

Package rocketchatbee is a Bee that can connect to Rocketchat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url, userID, authToken string) *Client

func (*Client) GetChannelID

func (c *Client) GetChannelID(name string) (string, error)

getChannelID returns the ID of a channel

func (*Client) SendMessage

func (c *Client) SendMessage(channel, text, alias string) error

func (*Client) TestConnection

func (c *Client) TestConnection() error

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse

type Message

type Message struct {
	Text      string `json:"msg"`
	ChannelID string `json:"rid"`
	Alias     string `json:"alias,omitempty"`
}

Message defines a chat message

type MessageContainer

type MessageContainer struct {
	Message Message `json:"message"`
}

MessageContainer is sent to Rocket.Chat to create a chat message

type RocketchatBee

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

RocketchatBee is a Bee that can connect to Rocketchat.

func (*RocketchatBee) Action

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

Action triggers the action passed to it.

func (*RocketchatBee) ReloadOptions

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

ReloadOptions parses the config options and initializes the Bee.

type RocketchatBeeFactory

type RocketchatBeeFactory struct {
	bees.BeeFactory
}

RocketchatBeeFactory is a factory for RocketchatBees.

func (*RocketchatBeeFactory) Actions

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

Actions describes the available actions provided by this Bee.

func (*RocketchatBeeFactory) Description

func (factory *RocketchatBeeFactory) Description() string

Description returns the description of this Bee.

func (*RocketchatBeeFactory) ID

func (factory *RocketchatBeeFactory) ID() string

ID returns the ID of this Bee.

func (*RocketchatBeeFactory) Image

func (factory *RocketchatBeeFactory) Image() string

Image returns the filename of an image for this Bee.

func (*RocketchatBeeFactory) LogoColor

func (factory *RocketchatBeeFactory) LogoColor() string

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

func (*RocketchatBeeFactory) Name

func (factory *RocketchatBeeFactory) Name() string

Name returns the name of this Bee.

func (*RocketchatBeeFactory) New

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

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

func (*RocketchatBeeFactory) Options

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

Options returns the options available to configure this Bee.

type Room

type Room struct {
	ID string `json:"_id"`
}

Room is a Channel in Rocket.Chat

type RoomResponseContainer

type RoomResponseContainer struct {
	Room Room `json:"room"`
}

RoomResponseContainer is used to receive the ID of a room/channel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL