Coder Social home page Coder Social logo

hubot-skypebots's Introduction

Depricated repository. This project isn't suppoted anymore. Please use official Microsoft Bot SDK which has more features!

A Skype Bot Api Adapter for Hubot

Build Status npm version

Installation

Configuration

  • SKYPE_BOTS_APP_ID - the Application ID generated in a Microsoft portal
  • SKYPE_BOTS_APP_SECRET - the Application Secret generated in the Microsoft portal
  • SKYPE_BOTS_BOT_ID - a Skype bot ID
  • SKYPE_BOTS_LISTEN_PATH - a web path on your server to listen chat responses/outgoing webhooks. The url should be accessable from the internet.
export SKYPE_BOTS_APP_ID=111111111-aaaa-bbbb-cccc-222222222222
export SKYPE_BOTS_APP_SECRET=secret_secret
export SKYPE_BOTS_BOT_ID=28:xxxxxxx-aaaa-bbbb-cccc-zzzzzzzzzzzz
export SKYPE_BOTS_LISTEN_PATH=/skype
`bin/hubot -a skypebots`

Encoding html entities

By default html entities "<",">" and "&" are escaped. To disable this behaviour you can set a property 'envelope.escape' to false. Bear in mind that Skype doesn't allow some html tags and silently ignores messages with unclosed tags.

  robot.respond /small/i, (res) ->
    html = "<font size=\"15\">It's small</font>"
    res.send html
  robot.respond /big/i, (res) ->
    res.envelope.escape = false
    html = "<font size=\"15\">It's big</font>"
    res.send html

Send files

Attachments can be send using Skype Bot Api. Supported types 'Images', 'Videos' and 'Files'. To send attachment you need to emit a 'skype:sendAttachment' event with params:

  • user - a User object
  • attachmentName - File/Image/Video name
  • attachmentType - a type of a data content (File, Image or Video)
  • originalStream - a nodejs stream of the data content
  • thumbnailStream - (optional) nodejs stream of a video thumbnail content. Used only by Video type. Videos thumbnails should be JPEG

Send File

robot.respond /get settings/i, (res) ->
    user = res.envelope.user
    originalStream = fs.createReadStream("files/settings.json")
    robot.emit 'skype:sendAttachment', user, 'settings.json', 'FILE',  originalStream

Send Image

robot.respond /get image with funny cats/i, (res) ->
    user = res.envelope.user
    originalStream = fs.createReadStream("files/funny_cats.jpg")
    robot.emit 'skype:sendAttachment', user, 'funny_cats.jpg', 'Image',  originalStream

Send Video

robot.respond /get epic fail video/i, (res) ->
    user = res.envelope.user
    originalStream = fs.createReadStream("files/epic_fail.mp4")
    thumbnailStream = fs.createReadStream("files/thumbnail-epic_fail.jpg")
    robot.emit 'skype:sendAttachment', user, 'epic_fail.mp4', 'Video',  originalStream, thumbnailStream

Receive File

Attachments can be received using Skype Bot Api. When SkypeBots adapter receive a new attachment it emit a 'skype:attachment' with params

  • user - a User object
  • attachmentName - File/Image/Video name
  • attachmentType - a type of a data content (File, Image or Video)
  • attachmentStream - a nodejs stream of a data content
robot.on 'skype:attachment', (user, attachmentName, attachmentType, attachmentStream) ->
    robot.logger.info "Revceived attachment #{attachmentName} of type #{attachmentType} from #{user.id} in room #{user.room}"
    attachmentStream.pipe(fs.createWriteStream("files/#{attachmentName}"))

hubot-skypebots's People

Contributors

ivadim avatar

Stargazers

Luke Farnell avatar Zack Fernandes avatar Amor avatar Gabriel Francisco avatar Olivier Lemasle avatar Chris Sprance avatar

Watchers

James Cloos avatar  avatar Amor avatar  avatar

hubot-skypebots's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.