Пример #1
0
        // POST https://api.line.me/v2/bot/message/push
        // to a user, group, or room a
        public string PushMessage(string targetID, Message[] msgs, string channelAccessToken)
        {
            Models.PushMessage.Request body = new Models.PushMessage.Request();
            body.To = targetID;

            if (!is1To5(msgs))
            {
                throw new Exception("wrong length");
            }

            body.Messages = msgs;

            string data = JsonConvert.SerializeObject(body);

            return(WebRequestHelper.PostLineApi(LINE_URL + "/message/push", data, channelAccessToken));
        }
Пример #2
0
        // POST https://api.line.me/v2/bot/message/multicast
        // to multiple users
        public string MulticastMessage(string[] userIDs, Message[] msgs, string channelAccessToken)
        {
            Models.MulticastMessage.Request body = new Models.MulticastMessage.Request();
            body.To = userIDs;

            if (!is1To5(msgs))
            {
                throw new Exception("wrong length");
            }

            body.Messages = msgs;


            string data = JsonConvert.SerializeObject(body);

            return(WebRequestHelper.PostLineApi(LINE_URL + "/message/multicast", data, channelAccessToken));
        }
Пример #3
0
        // POST https://api.line.me/v2/bot/message/{messageId}/content
        public byte[] GetContent(string messageId, string channelAccessToken)
        {
            string str = WebRequestHelper.GetLineApi(LINE_URL + "/message/" + messageId + "/content", channelAccessToken);

            return(Encoding.Default.GetBytes(str));
        }