Below are the steps that you need to follow
First, you need to extract all the URLs in the message
urls = URI.extract(feed_item.content)
Then replace all the URLs with Bitly shorten URLs
urls.each do |url| feed_item.content.gsub(url, client.shorten(url).short_url) end
Then use auto_link
<%= auto_link(feed_item.content) %>