Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby Gem for Flowdock API
Ruby

Add changelog

Proper changelog is needed so that tracking changes between gem versions is easier. Fixes #29.
latest commit bca78fa66f
Otto Vehviläinen Mumakil authored
Failed to load latest commit information.
lib
spec Add general get/post/put/delete helpers
.document Use Jeweler to craft gem
.gitignore Remove and ignore Gemfile.lock
.rspec Initial commit
.travis.yml Ruby 1.8.7 is not supported
Gemfile Bump jeweler version
LICENSE Rename MIT-LICENSE to LICENSE
README.md Add changelog
Rakefile Use Jeweler to craft gem
VERSION Version bump to 0.5.0
flowdock.gemspec Regenerate gemspec for version 0.5.0

README.md

Flowdock

Ruby Gem for using the Flowdock Push API. See Push API documentation for details.

Build Status

Build Status

flowdock gem is tested on Ruby 1.9.3 and JRuby.

Dependencies

  • HTTParty
  • MultiJson

Installing

gem install flowdock

If you're using JRuby, you'll also need to install jruby-openssl gem.

Usage

To post content to Chat or Team Inbox using Flowdock::Flow, you need to use the target flow's API token.

Alternatively you can use your personal api token and the Flowdock::Client.

All tokens can be found in tokens page.

REST API

To create an api client you need your personal api token:

require 'rubygems'
require 'flowdock'

# Create a client that uses you api token to authenticate
client = Flowdock::Client.new(api_token: '__MY_PERSONAL_API_TOKEN__')

Posting to Chat

To send a chat message or comment, you can use the client.chat_message:

flow_id = 'acdcabbacd0123456789'

# Send a simple chat message
client.chat_message(flow: flow_id, content: "I'm sending a message!", tags: ['foo', 'bar'])

# Send a comment to message 1234
client.chat_message(flow: flow_id, content: "Now I'm commenting!", message: 1234)

Both methods return the created message as a hash.

Arbitary api access

You can use the client to access api in other ways too. See REST API documentation for all the resources.

# Fetch all my flows
flows = client.get('/flows')

# Update a flow's name
client.put('/flows/acme/my_flow', name: 'Your flow')

# Delete a message
client.delete('/flows/acme/my_flow/messages/12345')

# Create an invitation
client.post('/flows/acme/my_flow/invitations', email: 'user@example.com', message: "I'm inviting you to our flow using api.")

Push api

To use the push api, you need a flow token:

Posting to Chat

require 'rubygems'
require 'flowdock'

# create a new Flow object with target flow's api token and external user name (enough for posting to Chat)
flow = Flowdock::Flow.new(:api_token => "__FLOW_TOKEN__", :external_user_name => "John")

# send message to Chat
flow.push_to_chat(:content => "Hello!", :tags => ["cool", "stuff"])

Posting to Team Inbox

# create a new Flow object with target flow's api token and sender information for Team Inbox posting
flow = Flowdock::Flow.new(:api_token => "__FLOW_TOKEN__",
  :source => "myapp", :from => {:name => "John Doe", :address => "john.doe@example.com"})

# send message to Team Inbox
flow.push_to_team_inbox(:subject => "Greetings from Flowdock API Gem!",
  :content => "<h2>It works!</h2><p>Now you can start developing your awesome application for Flowdock.</p>",
  :tags => ["cool", "stuff"], :link => "http://www.flowdock.com/")

Posting to multiple flows

require 'rubygems'
require 'flowdock'

# create a new Flow object with the api tokens of the target flows
flow = Flowdock::Flow.new(:api_token => ["__FLOW_TOKEN__", "__ANOTHER_FLOW_TOKEN__"], ... )

# see above examples of posting to Chat or Team Inbox

API methods

  • Flowdock::Flow methods

    push_to_team_inbox - Send message to Team Inbox. See API documentation for details.

    push_to_chat - Send message to Chat. See API documentation for details.

    send_message(params) - Deprecated. Please use push_to_team_inbox instead.

  • Flowdock::Client methods

    chat_message - Send message to Chat.

    post, get, put, delete - Send arbitary api calls. First parameter is the path, second is data. See REST API documentation.

Deployment notifications

There are separate gems for deployment notifications:

Changelog

  • 0.5.0 - Added Flowdock::Client that authenticates using user credentials and can be used to interact with the api. Better threads support for both Flow and Client so that comments can be made.

Copyright

Copyright (c) 2012 Flowdock Ltd. See LICENSE for further details.

Something went wrong with that request. Please try again.