Skip to content

Instantly share code, notes, and snippets.

@kemayo
Created January 26, 2015 15:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kemayo/8e51823636cefa623a50 to your computer and use it in GitHub Desktop.
Save kemayo/8e51823636cefa623a50 to your computer and use it in GitHub Desktop.
Hubot plugin to drop a skype conference call link into the chat
# Description
# Drop a link into chat which will work as a skype conference call for the requested user
#
# Dependencies:
# "slack-node": "^0.0.95"
# "hubot-slack-attachment": "^1.0.0"
#
# Configuration:
# HUBOT_SLACK_TOKEN
# HUBOT_SLACK_INCOMING_WEBHOOK
#
# Commands:
# hubot skype call - respond with a link that will call the user
#
# Author:
# kemayo
Slack = require('slack-node')
module.exports = (robot) ->
slack = new Slack process.env.HUBOT_SLACK_TOKEN
robot.respond /skype call/i, (msg) ->
slack.api 'users.info', {user: msg.message.user.id}, (err, response) ->
user = response.user
if not (user and user.profile and user.profile.skype)
return
# I feel this _should_ work, but the link doesn't get parsed out
# msg.send '<skype:' + user.profile.skype + '?call&token=' + msg.message.room + '|Start a call>'
attachment =
message: msg.message,
content:
# see https://api.slack.com/docs/attachments
fallback: 'Skype call to skype:' + user.profile.skype + '?call&token=' + msg.message.room
text: '<skype:' + user.profile.skype + '?call&token=' + msg.message.room + '|Start a call>'
# channel: msg.message.room
# username: robot.name
# icon_url: "..."
# icon_emoji: "..."
robot.emit 'slack.attachment', attachment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment