This application can be deployed and then set as a Webhook within Fulcrum. Once this is done, Fulcrum will push changes to your data to this application, which will send them to Google's Fusion Tables.
First off, let's gather the configuration we'll need.
Below, we'll talk about these configuration variables:
What follows is how to determine what values you'll use for each configuration variable.
You'll need a Google account to interact with the Fusion Tables. This value is
simply your Google account's username. For instance, if your Gmail address is
firstname.lastname@example.org, your username is
This is the password for your Google account.
If you have Google's 2-step verification enabled, you will need to generate an application-specific password. Then use this application-specific password for this value, instead of your regular password. Using your regular password will cause issues since you can't perform the 2nd step of the verification.
If running locally, the config file is ignored from the git repository by default, so the password isn't going to be shared with everyone.
You need to use the Google account above to set up an API token. This token is tied to your Google account and will be used for interacting with your Google Fusion Tables. See the Notes section below for more details.
You'll likely want to use
https://web.fulcrumapp.com/api/v2 for this value.
If you're using something other than the default production API, however, be sure to change this value appropriately. For instance, when you're doing local development or testing outside of production.
Remember, this API key is specific to the organization, member and
FULCRUM_API_URL specified above.
Get It Running
Deploy to Heroku using the following steps:
- Clone this repo
- Install the Heroku Toolbelt
- Look for the application name from this
- Remember this name/URL for later
Use the configuration values from above to fill in these values:
heroku config:set GOOGLE_USERNAME=<value from above>
heroku config:set GOOGLE_PASSWORD=<value from above>
heroku config:set GOOGLE_API_KEY=<value from above>
heroku config:set FULCRUM_API_URL='<value from above>
heroku config:set FULCRUM_API_KEY=<value from above>
git push heroku master
For more help check out how to get started with Node.js on Heroku.
Go into Fulcrum and add your Heroku application's URL as a webhook.
cp config/env_vars.rb.sample config/env_vars.rb
Use the configuration values from above to fill in
Remember to change the API URL, since you're likely not hitting production. Also add your API key for the Fulcrum Organization you're interested in.
We need to run the Sinatra server:
In your local Fulcrum server, create a webhook with
localhost:9292 as the
See it in Action
This assumes everything is hooked up properly between Fulcrum and this app.
- Create a form in Fulcrum. Shortly, you'll see a Fusion Table in your Google Drive for this form.
- Create a record. Then you should see this as a record in that Fusion Table created above.
- Do an import in Fulcrum. Shortly you'll see the form and all the data in the appropriate Fusion Table.
Here's how things currently work:
- Each new from will be created as a new Fusion Table.
- A table will be created called
FulcrumApp_<FormName>_WithId_<FormId>. The name is constricted by the library used to work with Fusion Tables.
- Due to limits with the Fusion Tables API, there maybe some failures. The code will retry the same request until it succeeds or it reaches a maximum of 10 retries. This could exceed the 20 second timeout for the webhooks, but it's unlikely.
- A record that comes in with columns that aren't in the Fusion Table will not be able to be added with the user-filled in columns added. Only the "system" columns applicable to all fusion tables can be filled in, in this case. The data will still be available in JSON form in the 'form_fields' column.
Development and Testing
To change the port the application runs on, use the
-p option on
rackup -p 3002.
To run all the tests for Fulcrum Fusion, simply run:
bundle exec guard
This will run all the RSpec tests.
When you're doing development, guard will watch what files change and run the specs as needed.
As mentioned above, you'll need a Google API token to interact with the Fusion Tables. Follow these steps to get one.
- Make sure you're logged into the Google account you wish to use.
- Visit the developer console.
- Create a
New Projectwith a name and project ID to suit your needs.
- After this is created, go into the project.
- Click the
APIs & authlink.
- In the list of APIs, find
Fusion Tables API
- Click the
OFFbutton to toggle it to
- Then in list of links on the far left, click
CREATE NEW KEY, then
- Select another type or enter more specific info if you need more security.
- The API key shown here will be the