static class SlackMsg { S user, botName; // one of these is going to be set S userName; // looked up if user != null S type, text, ts; O reactions; S channelID; } static L slackSlurp(S channelID, S token, int limit, S oldest, S latest, boolean inclusive) { S url = "https://slack.com/api/channels.history"; Map postData = litmap( "token", token, "channel", channelID, "count", limit, "oldest", oldest, "latest", latest, "inclusive", inclusive ? 1 : 0); S data = doPost(postData, url); Map map = cast jsonDecode(data); assertTrue(map.get("ok")); List _msgs = cast map.get("messages"); new L msgs; for (Map msg : reversedList(_msgs)) { new SlackMsg m; m.type = (S) msg.get("type"); m.user = (S) msg.get("user"); m.botName = (S) msg.get("username"); m.text = htmldecode((S) msg.get("text")); m.ts = (S) msg.get("ts"); m.reactions = msg.get("reactions"); m.channelID = channelID; m.userName = slackGetUserName(token, m.user); msgs.add(m); //print(structure(m)); } //print(l(msgs) + " messages sucked from slack channel."); ret msgs; }