-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlaunchCollection.js
More file actions
31 lines (28 loc) · 1.08 KB
/
Copy pathlaunchCollection.js
File metadata and controls
31 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
WatcfyLaunchCollection = new Mongo.Collection('watcfylaunch');
var url = "add your hook url";
if(Meteor.isServer){
Meteor.methods({
'watcfyLaunch_signup': function(e){
check(e, String);
if(WatcfyLaunchCollection.find({email:e}).count() === 0){
WatcfyLaunchCollection.insert({email:e});
// create a slack web hook
HTTP.post(url,
{
data: {
"channel": "#watcfy-activities",
"username": "webhookbot",
"text": e + "has sign up on Watcfy coming soon website on watcfy.com.",
"icon_emoji": ":ghost:"
}
}, function(err, res){
if(err)
throw new Meteor.Error(404,'something wrong with slack hook.');
}
);
} else {
throw new Meteor.Error('exist', 'the email you enter already exist');
};
}
})
}