MessageResponder

MessageResponder

Class representing a bot message responder. Message responders always reply with the same canned message. See https://api.slack.com/docs/messages for information on Slack message formatting.

Constructor

new MessageResponder(options)

Create a bot message responder.
Source:
Parameters:
Name Type Description
options Object The responder options.
Name Type Attributes Description
message String | Object The message to respond with.
alias String | Alias <optional>
The alias to respond with. This must be either an Alias or the name of one registered the bot.
Examples

Create a message responder

new Bot.Responder.Message({
    message: 'Hello World!'
});

Create a message responder with an alias and more complex Slack message

new Bot.Responder.Message({
    alias: 'ExampleAlias',
    message: {
        text: 'Just wanted to say:',
        attachments: [
            { text: 'Hello World!' }
        ]
    }
});

Extends

Methods

(static) create() → {MessageResponder}

Create a bot message responder (see MessageResponder for parameters).
Source:
Returns:
Type:
MessageResponder
The new message responder.

(async) respond(message) → {Promise}

Respond to an incoming message with the responder message.
Overrides:
Source:
Parameters:
Name Type Description
message Object The Slack message to respond to.
Returns:
Type:
Promise
A promise which resolves when the message is sent.