Skip to content

Instantly share code, notes, and snippets.

@lookingcloudy
Forked from kemayo/slack-skype.coffee
Created November 2, 2015 14:58
Show Gist options
  • Save lookingcloudy/2b3daf111da7336e5e44 to your computer and use it in GitHub Desktop.
Save lookingcloudy/2b3daf111da7336e5e44 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