def create_webhook(url, event, options = {})
      raise InvalidEvent.new("Invalid event: #{event}") unless %w(room_message room_notification room_exit room_enter room_topic_change room_archived room_deleted room_unarchived).include? event

      begin
        u = URI::parse(url)
        raise InvalidUrl.new("Invalid Scheme: #{url}") unless %w(http https).include? u.scheme
      rescue URI::InvalidURIError
        raise InvalidUrl.new("Invalid URL: #{url}")
      end

      merged_options = {
        :pattern => '',
        :name => ''
      }.merge options

      response = self.class.post(@api.webhook_config[:url],
        :query => {
          :auth_token => @token
        },
        :body => {:url => url, :pattern => merged_options[:pattern], :event => event, :name => merged_options[:name]}.send(@api.send_config[:body_format]),
        :headers => @api.headers
      )

      ErrorHandler.response_code_to_exception_for :room, room_id, response
      response.body
    end
def create_webhook(url, event, options = {})
      raise InvalidEvent.new("Invalid event: #{event}") unless %w(room_message room_notification room_exit room_enter room_topic_change room_archived room_deleted room_unarchived).include? event

      begin
        u = URI::parse(url)
        raise InvalidUrl.new("Invalid Scheme: #{url}") unless %w(http https).include? u.scheme
      rescue URI::InvalidURIError
        raise InvalidUrl.new("Invalid URL: #{url}")
      end

      merged_options = {
        :pattern => '',
        :name => ''
      }.merge options

      response = self.class.post(@api.webhook_config[:url],
        :query => {
          :auth_token => @token
        },
        :body => {:url => url, :pattern => merged_options[:pattern], :event => event, :name => merged_options[:name]}.send(@api.send_config[:body_format]),
        :headers => @api.headers
      )

      ErrorHandler.response_code_to_exception_for :room, room_id, response
      response.body
    end
Create a webhook for this room

 Usage:

   # Default
   create_webhook 'http://example.org/path/to/my/webhook', 'room_event'

 Options:

 +pattern+::  The regular expression pattern to match against messages. Only applicable for message events.
                (default "")
 +name+::     The label for this webhook
                (default "")