Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > TinyBrain | #1002231 - Slack im.list test (list private message channels)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1110L/8K/25K).

!752

static S token;

p {
  token = devChannelToken();
  S url = "https://slack.com/api/im.list";
  Map postData = litmap("token", token);
  S data = doPost(postData, url);
  print(data);
  Map map = jsonDecodeMap(data);
  List<Map> ims = cast map.get("ims");
  new L<S> names;
  for (Map m : ims) {
    S userID = getString(m, "user");
    //print("userID = " + userID);
    S userName = slackGetUserName(token, userID);
    names.add(userName);
  }
  print("IM Users: " + join(", ", names));
}

Author comment

Began life as a copy of #1002230

download  show line numbers  debug dex   

Travelled to 8 computer(s): cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, mqqgnosmbjvj, onxytkatvevr, teubizvjbppd, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1002231
Snippet name: Slack im.list test (list private message channels)
Eternal ID of this version: #1002231/1
Text MD5: 5bfb8af2d96439cfc2199a12bd514e8f
Transpilation MD5: 072af97cabbed5f65235c9f67fc43eec
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-30 20:14:50
Source code size: 518 bytes / 22 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 236 / 183
Referenced in: [show]