slack client for emacs
Permalink
Failed to load latest commit information.
.gitignore ignore compiled elisp Jan 25, 2018
README.md Add client ID subsection Jun 26, 2018
helm-slack.el fix helm candidates sorted in each team Sep 27, 2018
slack-action.el check message is not ephemeral Aug 29, 2018
slack-attachment.el fix attachment get suggestions Aug 29, 2018
slack-bot-message.el fix action params Aug 3, 2018
slack-buffer.el not track to "no more message" and "load more message" Sep 27, 2018
slack-channel.el remove team-id from slack-room Aug 12, 2018
slack-conversations.el update topic and purpose when modified Sep 11, 2018
slack-dialog-buffer.el clear dialog's error before submit Sep 1, 2018
slack-dialog-edit-element-buffer.el create edit dialog element buffer Aug 29, 2018
slack-dialog.el clear dialog's error before submit Sep 1, 2018
slack-emoji.el require slack-request if using slack-request-handle-error Mar 12, 2018
slack-file-info-buffer.el remove slack-file-share-message, slack-file-comment(partially) Jul 26, 2018
slack-file-list-buffer.el fix slack-file-list Jul 28, 2018
slack-file.el fix file upload initial value Oct 9, 2018
slack-group.el use `slack-select-multiple` Oct 9, 2018
slack-im.el remove team-id from slack-room Aug 12, 2018
slack-message-buffer.el fix when no messages Oct 3, 2018
slack-message-compose-buffer.el set slack-current-buffer in init-buffer Nov 23, 2017
slack-message-edit-buffer.el remove team-id from slack-room Aug 12, 2018
slack-message-editor.el remove team-id from slack-room Aug 12, 2018
slack-message-formatter.el rm message Jul 30, 2018
slack-message-notification.el remove team-id from slack-room Aug 12, 2018
slack-message-reaction.el remove slack-file-share-message, slack-file-comment(partially) Jul 26, 2018
slack-message-sender.el Revert "fix channel removed from team" Sep 28, 2018
slack-message-share-buffer.el remove team-id from slack-room Aug 12, 2018
slack-message.el fix update message when replace Aug 22, 2018
slack-pinned-item.el remove slack-file-share-message, slack-file-comment(partially) Jul 26, 2018
slack-pinned-items-buffer.el remove slack-file-share-message, slack-file-comment(partially) Jul 26, 2018
slack-pkg.el Update websocket library to version 1.8 Sep 21, 2017
slack-reaction.el use function instead of string in help-echo property Jul 2, 2018
slack-reminder.el remove unused Aug 3, 2018
slack-reply.el use method to access slot instead of `oref` Jul 28, 2018
slack-request-worker.el response can be nil Mar 9, 2018
slack-request.el call abort on remove request from worker Mar 6, 2018
slack-room-buffer.el verify client_token Aug 29, 2018
slack-room-info-buffer.el update topic and purpose when modified Sep 11, 2018
slack-room-message-compose-buffer.el remove team-id from slack-room Aug 12, 2018
slack-room.el fix destroy rooms in arguments Sep 28, 2018
slack-search-result-buffer.el not track to "no more message" and "load more message" Sep 27, 2018
slack-search.el remove team-id from slack-room Aug 12, 2018
slack-selectable.el add slack-dialog Aug 29, 2018
slack-slash-commands.el add client-token to slash command Aug 29, 2018
slack-star.el fix arguments error Sep 11, 2018
slack-stars-buffer.el fix no applicable method Sep 11, 2018
slack-team.el display channel info in persistent action Sep 11, 2018
slack-thread-message-buffer.el remove team-id from slack-room Aug 12, 2018
slack-thread-message-compose-buffer.el remove team-id from slack-room Aug 12, 2018
slack-thread.el `json-encode` in `slack-ws-send` Aug 16, 2018
slack-user-message.el add slack-message-edited class instead of edited-at property Jul 30, 2018
slack-user-profile-buffer.el fix `slack-display-image` and add `slack-buffer--replace` Sep 11, 2018
slack-user.el reject deleted user Sep 11, 2018
slack-util.el add slack-select-multiple Oct 9, 2018
slack-websocket.el clear out minibuffer when timer canceled Sep 27, 2018
slack.el update doc Sep 27, 2018

README.md

Emacs Slack

GNU Emacs client for Slack.


Preview

You can see some gifs on the wiki.

Dependencies

Configuration

How to get token

;; I'm using use-package and el-get and evil

(el-get-bundle slack)
(use-package slack
  :commands (slack-start)
  :init
  (setq slack-buffer-emojify t) ;; if you want to enable emoji, default nil
  (setq slack-prefer-current-team t)
  :config
  (slack-register-team
   :name "emacs-slack"
   :default t
   :client-id "aaaaaaaaaaa.00000000000"
   :client-secret "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
   :token "xoxs-sssssssssss-88888888888-hhhhhhhhhhh-jjjjjjjjjj"
   :subscribed-channels '(test-rename rrrrr)
   :full-and-display-names t)

  (slack-register-team
   :name "test"
   :client-id "3333333333.77777777777"
   :client-secret "cccccccccccccccccccccccccccccccc"
   :token "xoxs-yyyyyyyyyy-zzzzzzzzzzz-hhhhhhhhhhh-llllllllll"
   :subscribed-channels '(hoge fuga))

  (evil-define-key 'normal slack-info-mode-map
    ",u" 'slack-room-update-messages)
  (evil-define-key 'normal slack-mode-map
    ",c" 'slack-buffer-kill
    ",ra" 'slack-message-add-reaction
    ",rr" 'slack-message-remove-reaction
    ",rs" 'slack-message-show-reaction-users
    ",pl" 'slack-room-pins-list
    ",pa" 'slack-message-pins-add
    ",pr" 'slack-message-pins-remove
    ",mm" 'slack-message-write-another-buffer
    ",me" 'slack-message-edit
    ",md" 'slack-message-delete
    ",u" 'slack-room-update-messages
    ",2" 'slack-message-embed-mention
    ",3" 'slack-message-embed-channel
    "\C-n" 'slack-buffer-goto-next-message
    "\C-p" 'slack-buffer-goto-prev-message)
   (evil-define-key 'normal slack-edit-message-mode-map
    ",k" 'slack-message-cancel-edit
    ",s" 'slack-message-send-from-buffer
    ",2" 'slack-message-embed-mention
    ",3" 'slack-message-embed-channel))

(use-package alert
  :commands (alert)
  :init
  (setq alert-default-style 'notifier))

How to get client ID

  1. Log into the Slack team you're interested in with a web browser
  2. Open DevTools
  3. Open Network tab
  4. Take the _x_id from Query String Parameters

How to get token (the easy way)

1. From Request Payload

  1. Log into the Slack team you're interested in with a web browser
  2. Open DevTools
  3. Open Network tab
  4. Search for (Ctrl-F) "xoxs-" and copy token from Request Payload

2. With a legacy token

  1. Go to "https://api.slack.com/custom-integrations/legacy-tokens".
  2. Create token for the teams you want to have integrate with.

How to get token (the harder yet officially sanctioned way)

1. Get client-id and client-secret

  1. Go to "https://api.slack.com/apps".
  2. Click "Create New App".
  3. Fill "App Name" and "Development Slack Team" and click "Create App".
  4. "Client ID" and "Client Secret" are listed in the "App Credentials" section.

2. Configure Redirect URL

  1. Click "Permissions" in the "Add features and functionality" of "Building Apps for Slack" section.
  2. Fill in the "Redirect URLs" section (slack-emacs defaults to: "http://localhost:8080").
  3. click "Save URLs".

3. Get token

  1. Call slack-register-team with above "Client ID" and "Client Secret" (ignore the "Token" prompt [i.e., just hit enter.]).
  2. Emacs' prompt will display: "Enter the code your browser displayed: ".
  3. Code appears in the browser's address bar like "http://localhost:8080?code=181818181818.1819919191&state=", enter this code in the previous Emacs' prompt.
  4. Once you activate emacs-slack, token appears in the URL like: "https://api.slack.com/apps/{APPID}/oauth".
  5. Save your token and pass it to the slack-register-team function along with the "Client ID" and "Client Secret".

Note

emacs-slack uses websocket to communicate with Slack, and need request to rtm.start method (you can also test your settings in that page's "Tester" tab to make sure things have been configured correctly). this request needs "client" scope when authorize and Slack does not yet have "client" scope in new OAuth scope. make sure slack-oauth2-auth requesting with "client" scope and prevent token migration. token_migration

How to use

I recommend to chat with slackbot for tutorial using slack-im-select.

Some terminology in the slack- functions:

  • im: An IM (instant message) is a direct message between you and exactly one other Slack user.

  • channel: A channel is a Slack channel which you are a member of

  • group. Any chat (direct message or channel) which isn't an IM is a group.

  • slack-register-team

    • set team configuration and create team.
    • :name, :client-id, and :client-secret are needed for arguments
  • slack-change-current-team

    • change slack-current-team var
  • slack-start

    • do authorize and initialize
  • slack-ws-close

    • turn off websocket connection
  • slack-group-select

    • select group from list
  • slack-im-select

    • select direct message from list
  • slack-channel-select

    • select channel from list
  • slack-group-list-update

    • update group list
  • slack-im-list-update

    • update direct message list
  • slack-channel-list-update

    • update channel list
  • slack-message-embed-mention

    • use to mention to user
  • slack-message-embed-channel

    • use to mention to channel
  • slack-file-upload

    • uploads a file
    • the command allows to choose many channels via select loop. In order to finish the loop input an empty string. For helm that's C+RET or M+TET. In case of Ivy it's C+M+j.

Notification

See alert.