Salesforce.com Inc. is in advanced talks to buy Slack Technologies Inc., according to people familiar with the matter, a deal that would unite a giant in business software with a buzzy newcomer on a mission to replace office email.