Releases: localytics/lambda-slack-router
v1.8.1
v1.8.0
v1.7.0
Response Structure
By default, the SlackBot will respond with the exact structure that slack expects. This will function properly using our scaffold because of the request template that we constructed:
"requestTemplates": {
"application/x-www-form-urlencoded": "{\"body\" : $input.json(\"$\")}"
}
You can, however, set up your own function to build the structure of your responses by setting the structureResponse property of the configuration object that you pass to the SlackBot constructor. This example below will be sufficient to get API gateway working out of the box:
var slackbot = new SlackBot({
structureResponse: function (response) {
return { body: JSON.stringify(response) };
}
});
v1.6.0
We've added the ability to respond to buttons!
See the slack documentation for more information on buttons.
The action configured must match the name
value of the presented button.
There's no need to use inChannelResponse or ephemeralResponse since your provided message will replace the existing message when using the callback.
slackbot.addAction('buttonPress', function (event, callback) {
callback(null, { text: "You pressed a button" });
});
v1.5.0
We've added the ability to configure a CloudWatch event on a schedule to keep the lambda alive. If the router sees that type of event come through, it will exit immediately in order to save as much processing time as possible. You can configure the slackbot with:
var slackbot = new SlackBot({ pingEnabled: true });
and then configure your event. More details in the README.
v1.4.0
This is a breaking change. In this release we pre-parse the information coming from slack such that the "body" property of the event object is already an object as opposed to a string. Additionally we now only support nodejs 4.3 on lambda, as we're taking advantage of the new callback function that does not halt execution when it is called.
v1.3.0
The entire event coming from slack and lambda is now being passed in to the commands. As such, the suggested naming for the first argument in the callback has been changed to event
instead of options
. Since it's using the built-in event, for upgrading you'll need to change userName
to user_name
if you were using that property on the options
object.
v1.2.0
v1.1.0
Optional arguments are now supported. This is a breaking change because the syntax for specifying arguments has now changed from being a space-separated string to being the second argument to the addCommand function. Example below:
slackbot.addCommand('test', ['one', 'two'], 'Test command', function() {});