Esempio n. 1
0
        protected override void Execute()
        {
            string to     = this.threemaId.Value;
            string from   = this.fromField.Value;
            string secret = this.secretField.Value;

            //string text = ReadStream(System.Console.In, Encoding.UTF8).Trim();
            string text = DataUtils.Utf8Endcode(System.Console.ReadLine().Trim());

            APIConnector apiConnector = this.CreateConnector(from, secret);
            string       messageId    = apiConnector.SendTextMessageSimple(to, text);

            System.Console.WriteLine(messageId);
        }
Esempio n. 2
0
        /// <summary>
        /// Wrapper to send simple message <see cref="Threema.MsgApi.APIConnector.SendTextMessageSimple"/>
        /// </summary>
        /// <param name="to">Recipient id</param>
        /// <param name="from">Sender id</param>
        /// <param name="secret">Sender sercret</param>
        /// <param name="text">Text message</param>
        /// <param name="apiUrl">Optional api url</param>
        /// <returns>Message id</returns>
        public string SendTextMessageSimple(string to, string from, string secret, string text, string apiUrl = APIConnector.DEFAULTAPIURL)
        {
            APIConnector apiConnector = this.CreateConnector(from, secret, apiUrl);

            return(apiConnector.SendTextMessageSimple(to, DataUtils.Utf8Endcode(text)));
        }