Advertising rules do not work the way people assume: what matters is not where something was said but what was said and to whom.
What counts as advertising
A message aimed at drawing attention to a product or service and addressed to an indefinite group of people. That last part is the key: answering one person's question is normally not advertising, while an identical message to a thousand strangers is.
Bulk messages
Sending advertising without the recipient's prior consent is a violation in most jurisdictions. The consent must exist before sending and must be demonstrable: if the person never signed up anywhere, there is nothing to demonstrate.
Labelling
In several jurisdictions advertising posts require marking and record-keeping. Rules change, and keeping up is the advertiser's obligation. Ignoring it is riskier than it looks: penalties attach to the missing label, not the content.
How a recommendation differs
By being an answer. When someone asks how to solve a problem and you name a tool, that is a recommendation. When you arrive with it first and address everybody, it is advertising with all the requirements attached.
The practical conclusion
Working through comments and replies means the labelling question rarely arises: you are answering specific people. The problems begin where bulk messaging of strangers begins — another reason to build contact in public. See the automation page.