Here’s a real-world example that walks you through getting started using webhooks in action with your data. For someone with programming experience, it should be quick to set up. This example uses Node.js to build a script to process webhook events.
This guide assumes you have:
- Experience with developing and deploying web applications
- Know-how of the following software:gitTerminal programs (e.g. iTerm 2)
- A Fulcrum plan that enables webhooks
- Proper roles & permissions to manage webhooks (e.g. you’re the organization owner)
An overview of the steps we’ll be working through:
- Deploy a simple Node.js application to Heroku
- Create a webhook in Fulcrum to use this application
- Create an app with data in Fulcrum
- Check that we see event requests from our Fulcrum app in the logs on Heroku
Deploy a Node.js Application to Heroku
Heroku is a platform for hosting applications in the cloud. They’re well-known service 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.
Deploy the Application
In the course of building the webhooks functionality, we created an application for testing. It’s called polis.js. The application receives HTTP POST requests and writes the contents to STDOUT. It’s the application we’ll set up as a webhook endpoint.
In your terminal:
- Navigate to a directory where you want to keep the source code
git clone https://github.com/fulcrumapp/polis.js.git
git push heroku master
heroku domains- Remember the output from here since it will be the URL of the webhook we create next
Test the Application
In your terminal:
This will open the site in your browser. The page should say polis.js is running.
Create a Webhook in Fulcrum to use this Application
In your browser:
- Log into your account on Fulcrum
- Click the cog in the upper right of the page
- If you were in another organization, on the left menu, click the name of the organization you’re interested in
API Webhooksin the list of links for that org’s settings
polis.jsas the webhook’s name
- Enter your heroku application’s URL as the webhook’s URL- This is the output from the
heroku domainscommand above
Create an App with Data in Fulcrum
Now that the webhook has been created, we can start using it.
Create a new app and a 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 Node.js app has received the requests. And we can check that next.
Check that We See those Event Requests in the Logs on Heroku
Now, let’s check out the application on Heroku to make sure it received the webhook event requests.
In the terminal:
- Navigate back to the polis.js folder, if necessary
- heroku logs
- At the bottom of the output from the above command, you should see a JSON payload of the event data from the POST request
Example of a
record.create event payload:
Note that one caveat of these logs is that they might not be in order. You’ll see that some of the lines won’t appear in the order the application actually wrote them out. But the logs do still show that we received the webhook event request.
We’ve successfully set up a webhook endpoint, created a webhook in Fulcrum, and seen how 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!