I disagree about the decent competitors -- there is e.g. Flowdock which in many ways (such as proper threading) is still better than Slack, and was doubly so back then. I think it's more about access to VC money and network effects, and indeed the successful marketing you mentioned.
Slack took the simplicity of IRC and gave it a modern interface with things like showing a preview when you link. easily share files etc.
What makes you think that? I don't see any connection between Flowdock and social media. As far as I can see, it's purely an internal communication tool with easy file sharing, hooks for external services as GitHub, and so on.
A neat thing is that you can start a discussion thread from any of these items, so the context of the discussion is clear.
Flowdock went a little further ahead when it came to how they constructed the base communication.
Mattermost is OSish, but Rocket.Chat seems to be a much more modern/UX friendly version compared to Zulip and fits the bill with FOSS.
IRC isn't a credible alternative for most users in 2017. It stagnated ages ago, which is obvious from problems like the fact that you can't even write a multi-line message.
My personal opinion is that Slack has been so successful primarily because nothing older than it (IRC, Campfire, HipChat) was a decently modern product by the time Slack launched and Slack was really good at marketing.
Personally, I'm trying to solve the problem of open source projects increasingly moving to Slack by working on Zulip, the leading open source alternative to Slack by contributor activity. Here's our story for why one should prefer Zulip to Slack for fellow open source projects (written a few days ago; feedback welcome!): https://zulipchat.com/for/open-source/