def generate_attachment
        payload = {}
        payload[:fallback]    = self.fallback    unless self.fallback.nil?
        payload[:color]       = self.color       unless self.color.nil?
        payload[:pretext]     = self.pretext     unless self.pretext.nil?
        payload[:author_name] = self.author_name unless self.author_name.nil?
        payload[:author_link] = self.author_link unless self.author_link.nil?
        payload[:author_icon] = self.author_icon unless self.author_icon.nil?
        payload[:title]       = self.title       unless self.title.nil?
        payload[:title_link]  = self.title_link  unless self.title_link.nil?
        payload[:text]        = self.message     unless self.message.nil?
        
        unless self.fields.nil?
            payload[:fields]      = self.fields if self.fields.length > 0
        end

        payload[:image_url]   = self.image_url   unless self.image_url.nil?

        payload
    end
def generate_attachment
        payload = {}
        payload[:fallback]    = self.fallback    unless self.fallback.nil?
        payload[:color]       = self.color       unless self.color.nil?
        payload[:pretext]     = self.pretext     unless self.pretext.nil?
        payload[:author_name] = self.author_name unless self.author_name.nil?
        payload[:author_link] = self.author_link unless self.author_link.nil?
        payload[:author_icon] = self.author_icon unless self.author_icon.nil?
        payload[:title]       = self.title       unless self.title.nil?
        payload[:title_link]  = self.title_link  unless self.title_link.nil?
        payload[:text]        = self.message     unless self.message.nil?
        
        unless self.fields.nil?
            payload[:fields]      = self.fields if self.fields.length > 0
        end

        payload[:image_url]   = self.image_url   unless self.image_url.nil?

        payload
    end
Generate the payload for slack attachments