Skip to content


Subversion checkout URL

You can clone with
Download ZIP


updating chargify_to_campfire ng example #82

merged 1 commit into from

2 participants


No description provided.

@iced iced merged commit 3026d9c into iron-io:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 14, 2012
  1. updating chargify_to_campfire example

    Roman Dzvinkovsky authored
This page is out of date. Refresh to see the latest.
23 ruby_ng/chargify_to_campfire_webhook_worker/
@@ -1,13 +1,16 @@
-# Github Webhook Worker
+# Chargify Webhook Worker
-This shows how to kick off a worker from a webhook. This example uses Github's Service Hooks.
+This shows how to kick off a worker from a webhook. This example uses Chargify's webhooks.
-## Getting started
+1. Be sure you've setup your credentials, see main [](
+1. Copy or rename the campfire_config_example.json to campfire_config.json and edit it to set your campfire credentials.
+1. `iron_worker upload chargify_to_campfire`
+1. See webhook url `iron_worker webhook chargify_to_campfire`
+1. Set it in chargify (Settings -> Webhooks)
+1. Select types of events you want to be notified of.
+1. Click 'Save Webhook settings'
+1. Click 'Send a test Webhook'
+1. Check the worker status and logs in IronWorker at to ensure it ran successfully.
+1. Check campfire for messages from webhook.
-- Copy or rename the webhook_config_example.yml to webhook_config.yml and edit it to set your hipchat credentials.
-- Upload the worker by running `upload.rb` in this directory and follow instruction it prints
-- Click Update Settings
-- Click Test Hook
-- Check the worker status and logs in IronWorker at to ensure it ran successfully.
-That's it, now everytime someone pushes to your github repo, it'll execute the GithubWebhookWorker on IronWorker.
+That's it, now you'll be notified about selected chargify events in campfire.
5 ruby_ng/chargify_to_campfire_webhook_worker/campfire_config_sample.json
@@ -0,0 +1,5 @@
+ "account": "sample",
+ "token": "12462462460f3456a3571e0456a7c5845f774674",
+ "room": "Room 1"
4 ruby_ng/chargify_to_campfire_webhook_worker/chargify_to_campfire.worker
@@ -0,0 +1,4 @@
+exec 'chargify_to_campfire_webhook_worker.rb'
+gem 'broach'
+file 'campfire_config.json'
+full_remote_build true
26 ruby_ng/chargify_to_campfire_webhook_worker/chargify_to_campfire_webhook_worker.rb
@@ -1,27 +1,21 @@
require 'cgi'
-require 'yaml'
require 'broach'
# the payload we get from github needs to be decoded first
cgi_parsed = CGI::parse(payload)
puts "cgi_parsed: #{cgi_parsed.inspect}"
-# Then we can parse the json
-#parsed = JSON.parse(cgi_parsed)
-#puts "parsed: #{parsed.inspect}"
-parsed = cgi_parsed # seems to already be in a hash?
+event = cgi_parsed["event"][0]
-@event = parsed["event"][0]
-# Also parse the config we uploaded with this worker for our Hipchat stuff
-webhook_config = YAML.load_file('webhook_config.yml')
-puts "webhook_config: #{webhook_config.inspect}"
-campfire_config = webhook_config['campfire']
+# parse campfire config
+cfg = JSON.parse('campfire_config.json'))
+puts "campfire config: #{cfg.inspect}"
Broach.settings = {
- 'account' => campfire_config['account'],
- 'token' => campfire_config['token'],
- 'use_ssl' => true
+ 'account' => cfg['account'],
+ 'token' => cfg['token'],
+ 'use_ssl' => true
-Broach.speak(campfire_config['room'], @event)
+Broach.speak(cfg['room'], event)
+puts 'Done'
19 ruby_ng/chargify_to_campfire_webhook_worker/upload.rb
@@ -1,19 +0,0 @@
-require 'iron_worker_ng'
-require_relative '../../ruby/examples_helper'
-config = ExamplesHelper.load_config
-# Create an IronWorker client
-client = => config['iw']['token'], :project_id => config['iw']['project_id'])
-# Create our code package containing the webhook
-code =>'chargify_to_campfire_webhook_worker.rb')
-code.merge_file 'webhook_config.yml'
-code.merge_gem 'broach'
-# Upload the code package
-url = "{config['iw']['project_id']}/tasks/webhook?code_name=#{}&oauth=#{config['iw']['token']}"
-puts "Add the following url to Github Service Hooks, Post Receive URLs: "
-puts url
4 ruby_ng/chargify_to_campfire_webhook_worker/webhook_config_example.yml
@@ -1,4 +0,0 @@
- account: "account number"
- token: "token"
- room: "room name"
Something went wrong with that request. Please try again.