       alertView = new AlertView "Please set your Pusher keys."
       atom.workspace.addModalPanel(item: alertView, visible: true)
     else
-      colourIndex = _.random(0, @colours.length)
-      @markerColour = @colours[colourIndex]
-      @sessionId = "#{@app_key}-#{@app_secret}-#{randomstring.generate(11)}-#{colourIndex}"
+      @generateSessionId()
       @startView = new StartView(@sessionId)
       @startPanel = atom.workspace.addModalPanel(item: @startView, visible: true)
       @startView.focus()
       @startPairing()
+
+  generateSessionId: ->
+    colourIndex = _.random(0, @colours.length)
+    @markerColour = @colours[colourIndex]
+    @sessionId = "#{@app_key}-#{@app_secret}-#{randomstring.generate(11)}-#{colourIndex}"
 
   inviteOverHipChat: ->
     @getKeysFromConfig()

    @receiveFriendInfo(data)
    @markerColour = colour


  getKeysFromConfig: ->
    @app_key = atom.config.get('pusher_app_key') || 'd41a439c438a100756f5'

        invitePanel.hide()

  sendHipChatMessageTo: (mentionName) ->
    if mentionName[0] isnt "@" then mentionName = ("@" + mentionName)
    hc_client = new HipChat(@hc_key)

    @generateSessionId()

    params =
      room: @room_id
