Ruby on Rails Integration

If you have a Ruby on Rails application, and you'd like to send events to Alooma, you can do so by sending us data in JSON format over HTTP and then adding a little custom code to the Code Engine. You can utilize our Custom Webhook input for this scenario.

  1. Add a Custom Webhook input from the Plumbing screen.

  2. Name the input and then copy the Token.

  3. Add the following code to your Ruby on Rails application, using the token from step 2:

    require "httpclient"
    require "json"
    event = {"mo"=>"rion"}
    properties = {"james"=>"othul"}
    payload = {
          event: event.to_json,
          properties: properties.to_json,
    client =, {
    headers: { "Content-Type" => "text/json" },
    body: payload
  4. Then, add the following code to the Code Engine:

    import json
    fields_to_jsonify = ['event', 'properties'] 
    def jsonify_event(event):
        for k in fields_to_jsonify: 
          if event.has_key(k):
            tmp = json.loads(event[k])
            event[k] = tmp
          return event 
    def transform(event):
        return event

That's it! You're now ready to send events from your Ruby on Rails application to Alooma. Let us know if you have any questions.

Search results

    No results found