Created
February 8, 2015 02:01
-
-
Save ryw/b1d80bfa2276b03c825f to your computer and use it in GitHub Desktop.
Adding Slack chat from your Meteor App
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
{ | |
"slack": { | |
"url": "https://hooks.slack.com/services/XXXXXXXX/XXXXXX/XXXXXXXXXXXXXXXXXX" | |
} | |
} |
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
class @Slack | |
@notify: (text) -> | |
if process.env.NODE_ENV is "production" | |
Job.push new SlackJob text: text |
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
class SlackJob extends Job | |
handleJob: ()-> | |
HTTP.post Meteor.settings.slack.url, | |
data: | |
channel: "#useractivity" | |
username: "The App" | |
text: @params.text | |
icon_url: "https://usercycle.com/img/icon.png" | |
link_names: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment