Skip to content
errror edited this page Jan 21, 2016 · 6 revisions

SlackRTM (Real Time Messaging API) sync plugin

Features

This plugin is similar to the existing Slack webhook-based plugin that has been shipping with hangoutsbot, but has a number of advantages to the classic plugin.

  • It will bridge private groups to hangouts, in addition to public channels
  • Only a single configuration per Slack team is needed (not per-channel)
  • The RTM API is faster than the web hooks
  • Can share images across the bridge
  • Most configuration is at run-time using commands on either the HO or Slack side
  • Can sync thousands of channels and multiple slack teams
  • Can sync one channel/group to into more than one Hangout

Configuration

Add the following section into hangoutsbot's config.json

"slackrtm": [
    {
      "name": "slack-team-name",
      "key": "xoxb-xxxx-Bot-API-Key-From-Slack",
      "admins": [ "U0123456", "U234567", … ]
    },
    {
      "name": "other-slack-team"
      "key": "xoxb-xxxx-Bot-API-Key-From-Slack",
      "admins": [ "U4567890", "U8675309", … ]
    }
]
  • name: The name of your Slack team as you want to use it for runtime commands and logging
  • key: When you configure a BOT user integration, an API key, typically started with xoxb- is generated by Slack for that particular botuser. Alternatively, since botusers have limited features, you might consider using a real user especially created for this purpose. In that case you have to login once with that user and retrieve a web API key from https://api.slack.com/web. The username of that Slack user or bot will be called hobot in the following examples.
  • admins: An array of slack user-ids for people allowed to administer the sync bot. If your Slack RTM plugin is already configured, you may request your own user id with the command @hobot whoami or, you can search for user IDs using https://api.slack.com/methods/users.list -> Test. You can specify multiple admin users as shown above.

You can list multiple teams re-using the complete {"name": "...", “key": "...", "admins": []} block, separated by comma.

Commands

The slackrtm plugin supports many commands to create/configure/shutdown syncs during runtime. The commands can be sent from Slack or from Hangouts. All commands are persistent: created bridges are stored in hangupsbot's memory.json and restarted when hangupsbot restarts. Similar shutting down a bridge will remove the corresponding entry from memory.json.

Slack

Since SlackRTM uses a user (bot or real) to perform bridge operations, all commands sent from Slack to the bot are prefixed with the name of the bot user (e.g. @hobot <command>). Most commands are limited to users configured in the admins section of config.json.

@hobot help displays a list of commands:

  • @hobot whereami ​tells you the current channel/group id
  • @hobot whoami ​tells you your own user id
  • @hobot whois @username tells you the user id of @username
  • @hobot admins lists the slack users with admin privileges
  • @hobot hangoutmembers lists the users of the hangouts synced to this channel
  • @hobot hangouts lists all connected hangouts (only available for admins, use in DM with hobot suggested)
  • @hobot listsyncs lists all running sync connections (only available for admins, use in DM with hobot suggested)
  • @hobot syncto <hangoutid> [shortname] starts syncing messages from current channel/group to specified Hangout (specified by the Hangout's ID as listed by the /bot hangouts command). If shortname given, messages from the Hangout will be tagged with shortname instead of Hangout title (only available for admins)
  • @hobot disconnect <hangoutid> stops syncing messages from current channel/group to specified Hangout (only available for admins)
  • @hobot setsyncjoinmsgs <hangoutid> [true|false] enable/disable messages about joins/leaves/adds/invites/kicks in synced Hangout/channel, default is enabled (only available for admins)
  • @hobot sethotag <hangoutid> [HOTAG|none] set the tag, that is displayed in Slack for messages from that Hangout (behind the user's name), default is the hangout title when sync was set up, use "none" if you want to disable tag display (only available for admins)
  • @hobot setimageupload <hangoutid> [true|false] enable/disable upload of shared images in synced Hangout, default is enabled (only available for admins)

Hangouts

The commands, provided by this plugin from Hangouts follow the hangupsbot command scheme. You can get help about each command with /bot help command and get a list of all available commands with /bot help. Currently all commands available from Hangouts for slackrtm are for admins only.

  • /bot slacks list all configured slack teams
  • /bot slack_channels <teamname> list all slack channels/groups available to the Slack bot user
  • /bot slack_listsyncs list of all current conversations we are syncing
  • /bot slack_syncto <teamname> <channelid> start syncing the current hangout to a given slack team/channel (specified by Slack channel-id (use the slack_channels command to get channel/group IDs)
  • /bot slack_disconnect <teamname> <channelid> stop syncing the current hangout with given slack team and channel
  • /bot slack_setsyncjoinmsgs <teamname> <channelid> {true|false} enable or disable sending notifications any time someone joins/leaves/adds/invites/kicks, default is true
  • /bot slack_setimageupload <teamname> <channelid> {true|false} enable/disable image upload between the synced conversations, default is true
  • /bot slack_sethotag <teamname> <channelid> {<tag>|none} sets the identity of current hangout when syncing this conversation (default: title of this hangout when sync was set up, use 'none' to disable tagging)

# ## ###

Clone this wiki locally