       @robot.logger.debug "Sending to #{envelope.room}: #{msg}"
 
       if msg.length <= SlackBot.MAX_MESSAGE_LENGTH
-        @client.sendMessage msg, envelope.room
+        @sendFormatted msg, envelope.room
 
       # If message is greater than MAX_MESSAGE_LENGTH, split it into multiple messages
       else

{Robot, Adapter, EnterMessage, LeaveMessage, TopicMessage} = require 'hubot'
{SlackTextMessage, SlackRawMessage, SlackBotMessage} = require './message'
{SlackRawListener, SlackBotListener} = require './listener'
{RtmClient, MemoryDataStore} = require '@slack/client'

class SlackBot extends Adapter
  @MAX_MESSAGE_LENGTH: 4000


            msg = msg.substring(breakIndex, msg.length)

        @sendFormatted(m, envelope.room) for m in submessages

  sendFormatted: (message, room) ->    
    # RTM doesn't support formatted Urls, so we'll use the web client instead
    if /<.+\|.+>/.test(message)
      @webClient.chat.postMessage(room, message)
    else
      @client.sendMessage(message, room)


  reply: (envelope, messages...) ->
    @robot.logger.debug "Sending reply"
