Is this legal according to Swiss contract law?
Yes. The lawfulness of terminating a contract expressly or implicitly (see "ausdrückliche oder stillschweigende"), with no further requirements, implies that outlining the specifics to that effect are within the parties' freedom of contract.
A priori, the premise that "Yallo (telecommunication) does not accept written contract terminations" seems inaccurate. The site indicates that chat is a valid method for cancellation. Chats are in writing.
That being said, the matter --at least at the time of this writing-- sounds in misleading practices insofar as the chat functionality is unavailable. Clicking on the page for termination of services issues the message that "because of CyberMonday the hotline is overstrained". Similarly, clicking there on "Chat" leads to another page, so the customer ends up dealing with circular references rather than a chat. As such, the company is in violation of the Bundesgesetz gegen den unlauteren Wettbewerb.