     wrapper.addSubView @inviteChannel = new kd.ButtonView
       cssClass : 'solid medium green invite-members'
       title    : titleHelper @counts.general, '#general'
+      callback : =>
+
+        return  unless @users
+
+        channelMemberIds = @allChannels[select.getValue()].members
+        recipients       = @users.filter (user) -> user.id in channelMemberIds
+
+        @sendMessages recipients
+
 
 
   createIndividualInviter: (users) ->
 
-    users = users.filter (user) -> user.id isnt SLACKBOT_ID
+    @users = users = users.filter (user) -> user.id isnt SLACKBOT_ID
 
     @wrapper.addSubView new kd.CustomHTMLView
       tagName : 'h3'

      @inviteIndividual.enable()
      @inviteIndividual.setTitle title


    list.addSubView @inviteIndividual = new kd.ButtonView
      cssClass : 'solid medium green invite-members fr'
      title    : 'Invite selected members'
      disabled : yes
      callback : => @prepareMessages getSelectedMembers listController


  prepareMessages: (recipients) ->



    recipients.forEach (recipient) ->
      $.ajax
        url              : MESSAGING_URL
        method           : 'POST'
        headers          :
          Accept         : 'application/json'
          'Content-Type' : 'application/json'
        data             : JSON.stringify
          channel        : recipient.id
          text           : 'Invite ulan!'
          params         :
            as_user      : no
            username     : whoami().profile.firstName
            icon_url     : ICON_URL
            icon_emoji   : ':cihangir:'
        success: ->
          console.log 'success'
        error: ->
          console.log 'error'



  sendMessage: (message) ->

  USERS_URL     = "#{location.origin}/api/social/slack/users"
  CHANNELS_URL  = "#{location.origin}/api/social/slack/channels"
  MESSAGING_URL = "#{location.origin}/api/social/slack/message"
  ICON_URL      = "https://koding.com/a/images/logos/notify_logo.png"

  constructor: (options = {}, data) ->

