!752 static class Msg { // either user (internal user ID) is set or botName S type, user, text, ts; S botName; O reactions; } static S data; static new L msgs; // Note: They're in reverse order! static S token; static S channelID = "C0FH9PY8J"; // #talkingbots //static S oldest = "1449245380.000382"; // timestamp of first msg to get static int limit = 10; // get n messages max p { token = loadSecretTextFileMandatory("#1001889", "relp-slack-botstuff-token").trim(); S url = "https://slack.com/api/channels.history"; S postData = "token=" + urlencode(token) + "&channel=" + urlencode(channelID) + /*"&oldest=" + urlencode(oldest) +*/ "&count=" + limit; data = doPost(postData, url); print(data); Map map = cast jsonDecode(data); assertTrue(map.get("ok")); List _msgs = cast map.get("messages"); msgs = new ArrayList(); for (Map msg : _msgs) { new Msg m; m.type = (S) msg.get("type"); m.user = (S) msg.get("user"); m.botName = (S) msg.get("username"); m.text = (S) msg.get("text"); m.ts = (S) msg.get("ts"); m.reactions = msg.get("reactions"); msgs.add(m); print(structure(m)); } print(l(msgs) + " messages sucked from slack channel."); }