slack-service.js
/**
 * Sends a direct message to the slack user with the given email
 * @param  {string} email
 * @param  {string} message
 */
Sends a direct message to the slack user with the given email
@param  {string} email
@param  {string} message
Sends a direct message to the slack user with the given email @param { string } email @param { string } message
function sendMessage(email, message) {
	bot.startRTM(function(err, bot, payload) {
		bot.api.users.list({}, function (err, response) {
			var users = _.filter(response.members, function(user) {
				return user.profile.email === email;
			}) || [];
			if (users.length > 0) {
				var targetUser = users[0];
				bot.startPrivateConversation({
					user: targetUser.id
				},
				function(err, conversation) {
					conversation.say(message);
				});
			}
	    });
	});
}
function sendMessage ( email , message ) { bot . startRTM ( function ( err , bot , payload ) { bot . api . users . list ( { } , function ( err , response ) { var users = _ . filter ( response . members , function ( user ) { return user . profile . email === email ; } ) || [ ] ; if ( users . length > 0 ) { var targetUser = users [ 0 ] ; bot . startPrivateConversation ( { user : targetUser . id } , function ( err , conversation ) { conversation . say ( message ) ; } ) ; } } ) ; } ) ; }
Sends a direct message to the slack user with the given email
 @param  {string} email
 @param  {string} message
Sends a direct message to the slack user with the given email @param { string } email @param { string } message
//Find user info //Send message if user exists //Select user to talk to //Send message