-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checking slack token in index handler, extracting env vars and slack …
…body properties
- Loading branch information
chrisdevwords
authored and
chrisdevwords
committed
Aug 12, 2017
1 parent
a3c5720
commit da743bd
Showing
3 changed files
with
102 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const { response } = require('../util/lambda') | ||
|
||
// response types | ||
const TYPE_PRIVATE = 'ephemeral'; | ||
const TYPE_PUBLIC = 'in_channel'; | ||
|
||
// error messages | ||
const INVALID_TOKEN = 'Slack token is invalid.'; | ||
|
||
function slackResp(text, code = 200, type = TYPE_PUBLIC) { | ||
return response({ | ||
// eslint-disable-next-line camelcase | ||
response_type: type, | ||
text | ||
}, code); | ||
} | ||
|
||
module.exports = { | ||
TYPE_PUBLIC, | ||
TYPE_PRIVATE, | ||
INVALID_TOKEN, | ||
slackResp | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters