Skip to content

slack-ruby/slack-api-explorer

Repository files navigation

Slack API Explorer

Add to Slack

Or roll your own ...

test

An API explorer for Slack.

You can DM the bot.

Or invite it to a channel.

Post a message into a channel.

Usage

Help

Get help with api help.

Basics

All the commands of slack-ruby-client are supported. The output is JSON.

auth test

{
  "ok": true,
  "url": "https://dblockdotorg.slack.com/",
  "team": "dblock",
  "user": "api",
  "team_id": "T04KB5WQH",
  "user_id": "U0HPMN0GY"
}

Parsing

You can pipe a JSON parser. See jsonpath for detailed syntax.

Your team ID.

auth test | $.team_id

[
  "T04KB5WQH"
]

Names of all unarchived channels.

channels list | $..[?(@.is_archived==false)].name

[
  "demo",
  "general",
  "apiapi",
]

Find out the ID of the #general channel, the easy way.

channels id --channel=#general

{
  "ok": true,
  "channel": {
    "id": "C04KB5X4D"
  }
}

Find out the ID of the #general channel, the hard way.

channels list | $..[?(@.name=="general")].id

[
  "C04KB5X4D"
]

Post a message into the #general channel.

chat postMessage --as_user=true --text="Hello World" --channel=#general

{
  "ok": true,
  "channel": "C034LSACD",
  "ts": "1453588359.000006",
  "message": {
    "type": "message",
    "user": "U0K28DFCY",
    "text": "Hello World",
    "ts": "1453588359.000006"
  }
}

Contributing

This bot is built with slack-ruby-bot. See CONTRIBUTING.

Copyright and License

Copyright (c) 2016-2024, Daniel Doubrovkine, Vestris LLC, Artsy and Contributors.

This project is licensed under the MIT License.

Releases

No releases published

Packages

No packages published