You want to start using webhooks and we want to make getting started easier! So here’s a real-world example that walks you through the steps needed to see webhooks in action with your data. For someone with programming experience, it should be quick to set up.
This guide assumes you have:
Here’s an overview of the steps we’ll be working through.
Heroku is a platform for hosting applications in the cloud. They’re well-known and have good guides for new users. It’s possible to deploy a small application to Heroku for free. That’s what we’re working toward.
First, you’ll need a Heroku account.
In the course of building the webhooks functionality, we created an application for testing. It’s called fulcrum-webhook-sample-rails4. The application receives HTTP POST requests and writes the contents to its database. It’s the application we’ll set up as a webhook endpoint.
In your terminal:
git clone https://github.com/spatialnetworks/fulcrum-webhook-sample-rails4.git
ruby -e "require 'securerandom'; puts SecureRandom.hex(128);"
heroku config:set SECRET_TOKEN=<string from previous command output>
git push heroku master
heroku run rake db:migrate
In your terminal:
This will open the site in your browser. The page should say
Listing Webhook Event Requests.
In your browser:
API Webhooksin the list of links for that org’s settings.
Rails 4 Sample Endpointas the webhook’s name.
heroku domainscommand above.
Now that the webhook has been created, we can start using it.
Design a new app.
Textfield into the
Save and Exit.
Webhook Testapp in the list of your apps.
+sign to create a new record.
First Recordas the Name for this record.
You’ve created a new app and record within Fulcrum. Since we have an active webhook within our organization, an event is created for both the form and record we made. Each event generates requests for each of the webhooks in our org. Since we only have one webhook now, one request is made for the form and one for the record. Those requests are made to the webhook’s URL automatically. So now, we should expect that our Rails 4 app has received the requests. And we can check that next.
Now, let’s check out the application on Heroku to make sure it received the webhook events requests.
In the terminal:
fulcrum-webhook-sample-rails4folder, if necessary.
We’ve successfully set up the webhook endpoint, created the webhook in Fulcrum, and seen that they are connected.
Give yourself a pat on the back!
Now, you can check out the Webhooks Developer Documentation and begin building more sophisticated applications to extend Fulcrum!