def from_config(cls, filename):
        """
        Create a TelegramObserver from a given configuration file.

        The file can be in any format supported by Sacred
        (.json, .pickle, [.yaml]).
        It has to specify a ``token`` and a ``chat_id`` and can optionally set
        ``silent_completion``, ``started_text``, ``completed_text``,
        ``interrupted_text``, and ``failed_text``.
        """
        import telegram

        d = load_config_file(filename)
        request = cls.get_proxy_request(d) if "proxy_url" in d else None

        if "token" in d and "chat_id" in d:
            bot = telegram.Bot(d["token"], request=request)
            obs = cls(bot, **d)
        else:
            raise ValueError(
                "Telegram configuration file must contain "
                "entries for 'token' and 'chat_id'!"
            )
        for k in ["started_text", "completed_text", "interrupted_text", "failed_text"]:
            if k in d:
                setattr(obs, k, d[k])
        return obs

        Create a TelegramObserver from a given configuration file.

        The file can be in any format supported by Sacred
        (.json, .pickle, [.yaml]).
        It has to specify a ``token`` and a ``chat_id`` and can optionally set
        ``silent_completion``, ``started_text``, ``completed_text``,
        ``interrupted_text``, and ``failed_text``.
        
sacred/observers/telegram_obs.py